From 6e4c5e0a12bc007b495d6eb2dd8f633c5e616c84 Mon Sep 17 00:00:00 2001 From: 0tmc Date: Fri, 8 May 2015 12:22:37 +0300 Subject: [PATCH] Use of proper fstab file on FreeBSD --- lib/ansible/modules/system/mount.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/system/mount.py b/lib/ansible/modules/system/mount.py index 1f3429259c6..f052e36dd2d 100644 --- a/lib/ansible/modules/system/mount.py +++ b/lib/ansible/modules/system/mount.py @@ -226,13 +226,29 @@ def unset_mount(**kwargs): def mount(module, **kwargs): """ mount up a path or remount if needed """ + + # kwargs: name, src, fstype, opts, dump, passno, state, fstab=/etc/fstab + args = dict( + opts = 'default', + dump = '0', + passno = '0', + fstab = '/etc/fstab' + ) + args.update(kwargs) + mount_bin = module.get_bin_path('mount') name = kwargs['name'] + + cmd = [ mount_bin, ] + if os.path.ismount(name): - cmd = [ mount_bin , '-o', 'remount', name ] - else: - cmd = [ mount_bin, name ] + cmd += [ '-o', 'remount', ] + + if get_platform().lower() == 'freebsd': + cmd += [ '-F', args['fstab'], ] + + cmd += [ name, ] rc, out, err = module.run_command(cmd) if rc == 0: