diff --git a/changelogs/fragments/597_remove_fstab_comment_on_updating.yml b/changelogs/fragments/597_remove_fstab_comment_on_updating.yml new file mode 100644 index 0000000..c1c51a9 --- /dev/null +++ b/changelogs/fragments/597_remove_fstab_comment_on_updating.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - mount - If a comment is appended to a fstab entry, state present creates a double-entry (https://github.com/ansible-collections/ansible.posix/issues/595). diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index dadbd46..b9e496e 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -303,7 +303,7 @@ def _set_mount_save_old(module, args): continue - fields = line.split() + fields = line.split('#')[0].split() # Check if we got a valid line for splitting # (on Linux the 5th and the 6th field is optional)