mount module

Hi there,

I saw that the Ansible mount module has some issues, when i defined the fstab argument.

For example:
When I define an argument fstab (/tmp/fstab) and place the state on mounted. My mount point is /data/archive

The mount entry is placed in the custom fstab file and the mount is called with arguments:
mount /data/archive
and this resulted in error:

msg: Error mounting /data/archive: mount: can’t find /data/archive in /etc/fstab

This would mean that the mount command is called without the custom fstab file.
I check the source and i suggest these adjustments.

diff --git a/system/mount.py b/system/mount.py

index 9dc6fbe…4cb9b85 100644

— a/system/mount.py

+++ b/system/mount.py

@@ -209,10 +209,11 @@ def mount(module, **kwargs):

mount_bin = module.get_bin_path(‘mount’)

name = kwargs[‘name’]

  • fstab = kwargs[‘fstab’]

if os.path.ismount(name):

  • cmd = [ mount_bin , ‘-o’, ‘remount’, name ]
  • cmd = [ mount_bin , ‘-T’, fstab, ‘-o’, ‘remount’, name ]

else:

  • cmd = [ mount_bin, name ]
  • cmd = [ mount_bin, ‘-T’, fstab, name ]

rc, out, err = module.run_command(cmd)

if rc == 0: