mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 07:35:31 +01:00
read sysctl_dir files
This commit is contained in:
parent
806ff5c1a3
commit
d70d2aaaa7
1 changed files with 15 additions and 7 deletions
|
|
@ -101,6 +101,7 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import glob
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
|
@ -310,6 +311,13 @@ class SysctlModule(object):
|
||||||
# so return here and do not continue to the error processing below
|
# so return here and do not continue to the error processing below
|
||||||
# https://github.com/ansible/ansible/issues/58158
|
# https://github.com/ansible/ansible/issues/58158
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
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:
|
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
|
||||||
sysctl_args = [self.sysctl_cmd, '-p', self.sysctl_file]
|
sysctl_args = [self.sysctl_cmd, '-p', self.sysctl_file]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue