|
|
@ -45,6 +45,11 @@ options:
|
|
|
|
- Whether the entry should be present or absent in the sysctl file.
|
|
|
|
- Whether the entry should be present or absent in the sysctl file.
|
|
|
|
choices: [ "present", "absent" ]
|
|
|
|
choices: [ "present", "absent" ]
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
|
|
|
|
ignoreerrors:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Use this option to ignore errors about unknown keys.
|
|
|
|
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
|
|
|
|
default: no
|
|
|
|
reload:
|
|
|
|
reload:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- If C(yes), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is
|
|
|
|
- If C(yes), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is
|
|
|
@ -215,7 +220,11 @@ class SysctlModule(object):
|
|
|
|
rc,out,err = self.module.run_command('/etc/rc.d/sysctl reload')
|
|
|
|
rc,out,err = self.module.run_command('/etc/rc.d/sysctl reload')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# system supports reloading via the -p flag to sysctl, so we'll use that
|
|
|
|
# system supports reloading via the -p flag to sysctl, so we'll use that
|
|
|
|
rc,out,err = self.module.run_command([self.sysctl_cmd, '-p', self.sysctl_file])
|
|
|
|
sysctl_args = [self.sysctl_cmd, '-p', self.sysctl_file]
|
|
|
|
|
|
|
|
if self.args['ignoreerrors']:
|
|
|
|
|
|
|
|
sysctl_args.insert(1, '-e')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rc,out,err = self.module.run_command(sysctl_args)
|
|
|
|
|
|
|
|
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
self.module.fail_json(msg="Failed to reload sysctl: %s" % str(out) + str(err))
|
|
|
|
self.module.fail_json(msg="Failed to reload sysctl: %s" % str(out) + str(err))
|
|
|
@ -296,6 +305,7 @@ def main():
|
|
|
|
state = dict(default='present', choices=['present', 'absent']),
|
|
|
|
state = dict(default='present', choices=['present', 'absent']),
|
|
|
|
reload = dict(default=True, type='bool'),
|
|
|
|
reload = dict(default=True, type='bool'),
|
|
|
|
sysctl_set = dict(default=False, type='bool'),
|
|
|
|
sysctl_set = dict(default=False, type='bool'),
|
|
|
|
|
|
|
|
ignoreerrors = dict(default=False, type='bool'),
|
|
|
|
sysctl_file = dict(default='/etc/sysctl.conf')
|
|
|
|
sysctl_file = dict(default='/etc/sysctl.conf')
|
|
|
|
),
|
|
|
|
),
|
|
|
|
supports_check_mode=True
|
|
|
|
supports_check_mode=True
|
|
|
|