Using get_bin_path to find rmmod and modprobe

This commit is contained in:
Robert Osowiecki 2015-04-30 17:50:07 +02:00
parent 764a0e26b6
commit 4ffb5f065b

View file

@ -97,13 +97,13 @@ def main():
# Add/remove module as needed # Add/remove module as needed
if args['state'] == 'present': if args['state'] == 'present':
if not present: if not present:
rc, _, err = module.run_command(['modprobe', args['name'], args['params']]) rc, _, err = module.run_command([module.get_bin_path('modprobe', True), args['name'], args['params']])
if rc != 0: if rc != 0:
module.fail_json(msg=err, **args) module.fail_json(msg=err, **args)
args['changed'] = True args['changed'] = True
elif args['state'] == 'absent': elif args['state'] == 'absent':
if present: if present:
rc, _, err = module.run_command(['rmmod', args['name']]) rc, _, err = module.run_command([module.get_bin_path('rmmod', True), args['name']])
if rc != 0: if rc != 0:
module.fail_json(msg=err, **args) module.fail_json(msg=err, **args)
args['changed'] = True args['changed'] = True