mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixes #634 - multiple param handling by modprobe.py
This commit is contained in:
parent
4db5119893
commit
f1f98a15ca
1 changed files with 6 additions and 1 deletions
|
@ -57,6 +57,9 @@ EXAMPLES = '''
|
||||||
- modprobe: name=dummy state=present params="numdummies=2"
|
- modprobe: name=dummy state=present params="numdummies=2"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import shlex
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec={
|
argument_spec={
|
||||||
|
@ -100,7 +103,9 @@ 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([module.get_bin_path('modprobe', True), args['name'], args['params']])
|
command = [module.get_bin_path('modprobe', True), args['name']]
|
||||||
|
command.extend(shlex.split(args['params']))
|
||||||
|
rc, _, err = module.run_command(command)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg=err, **args)
|
module.fail_json(msg=err, **args)
|
||||||
args['changed'] = True
|
args['changed'] = True
|
||||||
|
|
Loading…
Reference in a new issue