3 Commits

Author SHA1 Message Date
Hideki Saito
b42cbb2a97 authorized_key: Use loop instead of with_file in example (#740) (#749)
Fixes: #607


(cherry picked from commit af933670cc)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2026-05-27 17:01:01 +09:00
Hideki Saito
aaacdb9d13 In FreeBSD, fail if loader.conf shall be reloaded. (#664) (#748)
Fix #663

(cherry picked from commit 3c232a2429)

Co-authored-by: Vladimir Botka <vbotka@gmail.com>
2026-05-27 15:45:16 +09:00
Hideki Saito
955acdca44 docs: added attributes metadata for check_mode support (fixes #643) (#741) (#747)
(cherry picked from commit 9cd0a1f0ef)

Co-authored-by: Patrick Kingston <66141901+pkingstonxyz@users.noreply.github.com>
Co-authored-by: jkhall81 <jason.kei.hall@gmail.com>
2026-05-27 14:18:58 +09:00
4 changed files with 27 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
---
trivial:
- sysctl - added the attributes section to the module documentation to reflect check_mode support (https://github.com/ansible-collections/ansible.posix/issues/643).

View File

@@ -0,0 +1,3 @@
---
bugfixes:
- sysctl - reload sysctl only if the sysctl file is ``/etc/sysctl.conf`` or ``/etc/sysctl.conf.local`` (https://github.com/ansible-collections/ansible.posix/issues/663).

View File

@@ -121,8 +121,8 @@ EXAMPLES = r'''
ansible.posix.authorized_key:
user: deploy
state: present
key: '{{ item }}'
with_file:
key: "{{ lookup('file', item) }}"
loop:
- public_keys/doe-jane
- public_keys/doe-john

View File

@@ -44,6 +44,7 @@ options:
- If V(true), performs a C(/sbin/sysctl -p) if the O(sysctl_file) is
updated. If V(false), does not reload C(sysctl) even if the
O(sysctl_file) is updated.
- For FreeBSD, can not be used with O(sysctl_file) other than C(/etc/sysctl.conf) or C(/etc/sysctl.conf.local).
type: bool
default: true
sysctl_file:
@@ -56,6 +57,17 @@ options:
- Verify token value with the sysctl command and set with C(-w) if necessary.
type: bool
default: false
attributes:
check_mode:
support: full
description: Can run in check_mode and return changed status prediction without modifying target.
diff_mode:
support: none
description: Does not support differences output.
platform:
platforms: posix
support: full
description: Supported on POSIX-compliant systems.
author:
- David CHANIAL (@davixx)
'''
@@ -155,6 +167,11 @@ class SysctlModule(object):
self.platform = platform.system().lower()
# system specific tests
freebsd_sysctl_files = ['/etc/sysctl.conf', '/etc/sysctl.conf.local']
if self.platform == 'freebsd' and self.sysctl_file not in freebsd_sysctl_files and self.args['reload']:
self.module.fail_json(msg="%s can not be reloaded. Set reload=False." % self.sysctl_file)
# Whitespace is bad
self.args['name'] = self.args['name'].strip()
self.args['value'] = self._parse_value(self.args['value'])