Add option to enable the sysctl -e option
This commit is contained in:
parent
e0429a4004
commit
cf80f9b68b
1 changed files with 11 additions and 2 deletions
|
@ -45,6 +45,11 @@ options:
|
|||
- Whether the entry should be present or absent in the sysctl file.
|
||||
choices: [ "present", "absent" ]
|
||||
default: present
|
||||
ignoreerrors:
|
||||
description:
|
||||
- Use this option to ignore errors about unknown keys.
|
||||
choices: [ "yes", "no" ]
|
||||
default: no
|
||||
reload:
|
||||
description:
|
||||
- If C(yes), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is
|
||||
|
@ -215,6 +220,9 @@ class SysctlModule(object):
|
|||
rc,out,err = self.module.run_command('/etc/rc.d/sysctl reload')
|
||||
else:
|
||||
# system supports reloading via the -p flag to sysctl, so we'll use that
|
||||
if self.args['ignoreerrors']:
|
||||
rc,out,err = self.module.run_command([self.sysctl_cmd, '-e', '-p', self.sysctl_file])
|
||||
else:
|
||||
rc,out,err = self.module.run_command([self.sysctl_cmd, '-p', self.sysctl_file])
|
||||
|
||||
if rc != 0:
|
||||
|
@ -296,6 +304,7 @@ def main():
|
|||
state = dict(default='present', choices=['present', 'absent']),
|
||||
reload = dict(default=True, type='bool'),
|
||||
sysctl_set = dict(default=False, type='bool'),
|
||||
ignoreerrors = dict(default=False, type='bool'),
|
||||
sysctl_file = dict(default='/etc/sysctl.conf')
|
||||
),
|
||||
supports_check_mode=True
|
||||
|
|
Loading…
Reference in a new issue