mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6296 from jdauphant/devel
Add linux module parameters for the modprobe module
This commit is contained in:
commit
3b285d736c
1 changed files with 11 additions and 1 deletions
|
@ -34,11 +34,19 @@ options:
|
|||
choices: [ present, absent ]
|
||||
description:
|
||||
- Whether the module should be present or absent.
|
||||
params:
|
||||
required: false
|
||||
default: ""
|
||||
version_added: "1.6"
|
||||
description:
|
||||
- Modules parameters.
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Add the 802.1q module
|
||||
- modprobe: name=8021q state=present
|
||||
# Add the dummy module
|
||||
- modprobe: name=dummy state=present params="numdummies=2"
|
||||
'''
|
||||
|
||||
def main():
|
||||
|
@ -46,6 +54,7 @@ def main():
|
|||
argument_spec={
|
||||
'name': {'required': True},
|
||||
'state': {'default': 'present', 'choices': ['present', 'absent']},
|
||||
'params': {'default': ''},
|
||||
},
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
@ -54,6 +63,7 @@ def main():
|
|||
'failed': False,
|
||||
'name': module.params['name'],
|
||||
'state': module.params['state'],
|
||||
'params': module.params['params'],
|
||||
}
|
||||
|
||||
# Check if module is present
|
||||
|
@ -82,7 +92,7 @@ def main():
|
|||
# Add/remove module as needed
|
||||
if args['state'] == 'present':
|
||||
if not present:
|
||||
rc, _, err = module.run_command(['modprobe', args['name']])
|
||||
rc, _, err = module.run_command(['modprobe', args['name'], args['params']])
|
||||
if rc != 0:
|
||||
module.fail_json(msg=err, **args)
|
||||
args['changed'] = True
|
||||
|
|
Loading…
Reference in a new issue