mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 15:15:26 +01:00
handle ignoreerrors consistently
This commit is contained in:
parent
571e80cdba
commit
560afe8217
2 changed files with 5 additions and 1 deletions
|
|
@ -358,7 +358,10 @@ class SysctlModule(object):
|
|||
if self.system_wide:
|
||||
for sysctl_file in self.SYSCTL_DIRS:
|
||||
for conf_file in glob.glob(sysctl_file):
|
||||
rc, out, err = self.module.run_command([self.sysctl_cmd, '-p', conf_file], environ_update=self.LANG_ENV)
|
||||
sysctl_args = [self.sysctl_cmd, '-p', conf_file]
|
||||
if self.args['ignoreerrors']:
|
||||
sysctl_args.insert(1, '-e')
|
||||
rc, out, err = self.module.run_command(sysctl_args, environ_update=self.LANG_ENV)
|
||||
if rc != 0 or self._stderr_failed(err):
|
||||
self.module.fail_json(msg="Failed to reload sysctl: %s" % to_native(out) + to_native(err))
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@
|
|||
ansible.posix.sysctl:
|
||||
name: test.invalid
|
||||
value: 1
|
||||
ignoreerrors: true
|
||||
register: sysctl_test3
|
||||
ignore_errors: true
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue