@ -234,7 +234,7 @@ def mount(module, **kwargs):
cmd = [ mount_bin , ]
cmd = [ mount_bin , ]
if os. path . ismount( name ) :
if ismount( name ) :
cmd + = [ ' -o ' , ' remount ' , ]
cmd + = [ ' -o ' , ' remount ' , ]
if get_platform ( ) . lower ( ) == ' freebsd ' :
if get_platform ( ) . lower ( ) == ' freebsd ' :
@ -311,7 +311,7 @@ def main():
if state == ' absent ' :
if state == ' absent ' :
name , changed = unset_mount ( module , * * args )
name , changed = unset_mount ( module , * * args )
if changed and not module . check_mode :
if changed and not module . check_mode :
if os. path . ismount( name ) :
if ismount( name ) :
res , msg = umount ( module , * * args )
res , msg = umount ( module , * * args )
if res :
if res :
module . fail_json ( msg = " Error unmounting %s : %s " % ( name , msg ) )
module . fail_json ( msg = " Error unmounting %s : %s " % ( name , msg ) )
@ -325,7 +325,7 @@ def main():
module . exit_json ( changed = changed , * * args )
module . exit_json ( changed = changed , * * args )
if state == ' unmounted ' :
if state == ' unmounted ' :
if os. path . ismount( name ) :
if ismount( name ) :
if not module . check_mode :
if not module . check_mode :
res , msg = umount ( module , * * args )
res , msg = umount ( module , * * args )
if res :
if res :
@ -345,7 +345,7 @@ def main():
name , changed = set_mount ( module , * * args )
name , changed = set_mount ( module , * * args )
if state == ' mounted ' :
if state == ' mounted ' :
res = 0
res = 0
if os. path . ismount( name ) :
if ismount( name ) :
if changed and not module . check_mode :
if changed and not module . check_mode :
res , msg = mount ( module , * * args )
res , msg = mount ( module , * * args )
elif ' bind ' in args . get ( ' opts ' , [ ] ) :
elif ' bind ' in args . get ( ' opts ' , [ ] ) :
@ -375,4 +375,6 @@ def main():
# import module snippets
# import module snippets
from ansible . module_utils . basic import *
from ansible . module_utils . basic import *
from ansible . module_utils . ismount import *
main ( )
main ( )