62 Commits
Author SHA1 Message Date
7a70c0607c fix(callback): align profile_tasks recap output width (#773) (#782)
Use display.columns and get_text_width() for TASKS RECAP headers,
timestamps, and timing rows so output matches display.banner() width.
Add truncate_task_names (default false, version_added 2.3.0) with
display-width-aware truncation and padding for multibyte task names.
Add unit tests for ASCII and CJK recap rows, including the reproducer
from #773.

Co-authored-by: Tom Paine <github@aioue.net>
2026-08-25 16:52:30 +09:00
Hideki SaitoandGitHub 61dba1eb25 [CI] Bump partner-certification-checker to v4.1.0 (#780) (#781)
- Fixes ansible-lint import crash

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-08-25 16:03:40 +09:00
Hideki SaitoandGitHub e0adbf54c4 Update AZP to follow ansible-test (#775) (#776)
- Replace FreeBSD 15.0 with 15.1


(cherry picked from commit ffdf9ef998)

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-08-07 16:07:03 +09:00
Hideki SaitoandGitHub e98d9a0756 Release 2.2.2 commit (#771)
Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-13 10:14:46 +09:00
Hideki SaitoandGitHub 73939ba8ff Update README Support section to reference Red Hat Automation Hub (#768) (#770)
Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-08 15:11:56 +09:00
Hideki SaitoandGitHub 2504f532b8 Remove meta-runtime[unsupported-version] line from the skip_list (#767) (#769)
Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-08 11:43:37 +09:00
Hideki SaitoandGitHub 4ac4603af5 Release 2.2.1 commit (#765)
2.2.1 release

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-02 10:43:07 +09:00
Hideki SaitoandGitHub a4805b92b7 Fixes the symlink handling issue in the authorized_key module (#760) (#762)
- Addresses CVE-2026-11837
- Fixes #759

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-01 12:30:27 +09:00
Hideki SaitoandGitHub ee1461f46c Replace remote test env RHEL9.7 and 10.1 with 9.8 and 10.2 (#764)
- Replace 9.7 with 9.8
- Replace 10.1 with 10.2
- Addresses https://github.com/ansible/ansible/pull/87120

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-07-01 11:56:25 +09:00
Hideki SaitoandGitHub 78fb77c8d5 Replace AZP remote test FreeBSD-14.2 with 14.3 for Ansible Core 2.19 (#755) (#756)
(cherry picked from commit 674315f2da)

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-06-10 12:54:21 +09:00
Hideki SaitoandGitHub d4ac6f63f4 [CI] AZP bump test container version to 8.0.0 (#751) (#752)
- Bump test container version to 8.0.0 for Ansible Core 2.18+
- Keep using 7.0.0 for Ansible Core 2.16 and 2.17. Both versions don't support Python3.13.


(cherry picked from commit f7945c4bc9)

Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-06-02 10:04:19 +09:00
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
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
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
Hideki SaitoandGitHub d9af430396 Release 2.2.0 commit (#739)
Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-05-18 20:44:23 +09:00
Hideki SaitoGitHubcentosinfra-prod-github-app[bot] <161850885+centosinfra-prod-github-app[bot]@users.noreply.github.com>
9cf6a06ca7 Merge pull request #638 from Silejonu/main (#738)
acl: correctly assert needed changes when recursive is true

SUMMARY
Right now, when setting recursive ACLs on a directory, all files in the directory are tested to check if a change is needed. If a single file has expected ACLs already set, then the test returns False and no changes are applied.
Fixes #592
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
acl
ADDITIONAL INFORMATION
I'm very much a beginner in Python, so any criticism is welcome.

Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit c4b1c2b0fb)

Co-authored-by: centosinfra-prod-github-app[bot] <161850885+centosinfra-prod-github-app[bot]@users.noreply.github.com>
2026-05-18 15:02:06 +09:00
1009d5cb28 Fix changelog fragment. (#720) (#737)
The changelog fragment for #687 claims that a feature is removed, which isn't the case. It's a simple bugfix.

(cherry picked from commit 3059c5138c)

Co-authored-by: Felix Fontein <felix@fontein.de>
2026-05-18 13:23:47 +09:00
42feec22c7 Fix _AnsibleActionDone deprecation in patch plugin (#687) (#736)
(cherry picked from commit ca22c6fe26)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Lee Garrett <leegarrett@users.noreply.github.com>
Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
2026-05-18 12:34:14 +09:00
ec51a15f69 [Backport][Stable-2] Backport for #715 and #719 (#735)
* firewalld_info: Use module.warn (#715)

* Use module.warn to display warnings instead of module.exit_json

Fixes: #710

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
(cherry picked from commit d88a3c833c)

* firewalld_info: Use PY2 compatible syntax (#719)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
(cherry picked from commit dbeb4a861d)

---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2026-05-18 11:58:00 +09:00
Hideki SaitoGitHubcentosinfra-prod-github-app[bot] <161850885+centosinfra-prod-github-app[bot]@users.noreply.github.com>
0b197ad440 Merge pull request #690 from barpavel/fix-686-module-utils-deprecation (#734)
Fix all deprecated module_utils imports before ansible-core 2.24 removal

SUMMARY
Fixes all deprecated ansible.module_utils imports across the entire collection that will be removed in ansible-core 2.24.
This PR comprehensively addresses deprecation warnings reported in #686 by updating import statements in 20 files to use the new recommended import paths, and removes 8 unused test utility files that contained deprecated imports.
Deprecated imports replaced:

Deprecated import
Replacement

ansible.module_utils._text
ansible.module_utils.common.text.converters

ansible.module_utils.common._collections_compat
collections.abc

ansible.module_utils.six.moves.shlex_quote
shlex.quote

ansible.module_utils.six.moves.reduce
functools.reduce

ansible.module_utils.six.moves.urllib.parse.urlparse
urllib.parse.urlparse

ansible.module_utils.six.string_types
basestring/str (Python 2/3 compatible)

ansible.module_utils.six.text_type
str

ansible.module_utils.six.PY3
Removed (simplified Python 2/3 conditionals)

ansible.module_utils.six.with_metaclass
Native metaclass= syntax

ansible.module_utils.six.iteritems
dict.items()

Files fixed (20 files, 1 commit per file for easier review):

plugins/action/patch.py
plugins/action/synchronize.py
plugins/callback/cgroup_perf_recap.py
plugins/callback/json.py
plugins/callback/jsonl.py
plugins/callback/profile_roles.py
plugins/callback/profile_tasks.py
plugins/modules/acl.py
plugins/modules/authorized_key.py
plugins/modules/firewalld_info.py
plugins/modules/mount.py
plugins/modules/patch.py
plugins/modules/rhel_rpm_ostree.py
plugins/modules/rpm_ostree_upgrade.py
plugins/modules/seboolean.py
plugins/modules/synchronize.py
plugins/modules/sysctl.py
plugins/shell/csh.py
plugins/shell/fish.py
tests/unit/modules/system/test_mount.py

Files deleted (8 unused test utility files):
These files are dead code - none of them are imported or used anywhere in the test suite or the collection. Removing them also addresses Python 2.7 compatibility concerns raised in code review, as several contained deprecated imports that would be incorrect to fix for Python 2.

tests/unit/compat/builtins.py
tests/unit/mock/loader.py
tests/unit/mock/path.py
tests/unit/mock/procenv.py
tests/unit/mock/vault_helper.py
tests/unit/mock/yaml_helper.py
tests/unit/modules/conftest.py
tests/unit/modules/utils.py

Completeness verified with:
git grep -n -P '_compat|utils._text|utils.six' -- '*.py' | grep -v yml

This command returns no results, confirming all deprecated imports have been replaced.
Notes on Python 2.7 compatibility:
For modules that may run on Python 2.7 managed hosts (e.g., authorized_key.py, synchronize.py, sysctl.py), Python 2/3 compatible fallbacks were used instead of direct Python 3 replacements:

authorized_key.py: try/except ImportError for urllib.parse.urlparse (falls back to urlparse on Python 2)
synchronize.py: try/except ImportError for shlex.quote (falls back to pipes.quote on Python 2)
sysctl.py: uses sys.version_info to set string_types to str on Python 3 (basestring on Python 2)

Also removes corresponding pylint:ansible-bad-import-from entries from tests/sanity/ignore-2.21.txt and tests/sanity/ignore-2.22.txt where applicable.
Fixes #686
ISSUE TYPE

Bugfix Pull Request

ADDITIONAL INFORMATION
Approach:
Each file is fixed in a separate commit for easier code review. The changelog fragment is added in a final commit. Corresponding pylint:ansible-bad-import-from ignore entries in tests/sanity/ignore-2.21.txt and tests/sanity/ignore-2.22.txt are removed in the same commit as the file fix (or the file removal commit).
CI results:
All 59 checks passing (Azure Pipelines sanity, units, lint, Docker, Remote across ansible-core 2.17 through devel, and Zuul ansible/check).

Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Pavel Bar
Reviewed-by: Abhijeet Kasurde
(cherry picked from commit 2022c1bd86)

Co-authored-by: centosinfra-prod-github-app[bot] <161850885+centosinfra-prod-github-app[bot]@users.noreply.github.com>
2026-05-18 11:23:20 +09:00
165babdd69 sysctl: Add custom sysctl file example (#606) (#733)
(cherry picked from commit 1b8aeb03cb)

Co-authored-by: Pavel Knoblokh <Pashugan@users.noreply.github.com>
2026-05-18 11:05:46 +09:00
Hideki SaitoGitHubsoftwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
8b5bba6fa1 Merge pull request #626 from pablomh/datetime_format (#732)
plugins/callback/profile_tasks.py: Add option to provide a different date/time format

SUMMARY
The new datetime_format key will offer the possibility of providing a different date/time format than the default one ('%A %d %B %Y  %H:%M:%S %z').

The iso8601 value can be used as an '%Y-%m-%dT%H:%M:%S.%f' alias (format of the ISO 8601 date/time standard).

The code has changed from using the time API to the datetime one in order to support sub-second precision (needed by the ISO 8601 format, for example).
Fixes: #279
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/callback/profile_tasks.py
ADDITIONAL INFORMATION

Output with no key which keeps current behavior:

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
Thursday 10 April 2025  00:52:11 +0200 (0:00:17.416)       0:00:17.453 ********
changed: [localhost]

Output with datetime_format = 'iso8601':

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
2025-04-10T00:55:19.967718 (0:00:15.664)       0:00:15.691 ********************
changed: [localhost]

Output with datetime_format = '%Y-%m-%dT%H:%M:%S.%f%z' (ISO 8601 with UTC offset information):

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
2025-04-10T00:57:49.290347+0200 (0:00:16.265)       0:00:16.293 ***************
changed: [localhost]

Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit 1994b2cf1c)

Co-authored-by: softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
2026-05-18 10:43:04 +09:00
Hideki SaitoGitHubsoftwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
714c50bdb7 Merge pull request #639 from Klaas-/Klaas-fix_authorized_key (#731)
Fixes #462 notice permission denied on authorized_key module

SUMMARY
As of right now the authorized_key module does not notice on an "absent" if a authorized_keys file is simply not readable to the executing user. I am trying to fix that
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
authorized_key
ADDITIONAL INFORMATION

Execute as a user that does not have access to the root users authorized keys file

- name: Delete key from root user
  ansible.posix.authorized_key:
    state: absent
    user: root
    key: ssh-rsa xxxxxxxx

- name: Delete key from root user
  become: true
  ansible.posix.authorized_key:
    state: absent
    user: root
    key: ssh-rsa xxxxxxxx

The one without become will succeed before my change and will fail with a permission denied error after my change. The 2nd task will actually remove a key from root user if become privileges are available for the executing user

Reviewed-by: Brian Coca
Reviewed-by: Klaas Demter
Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit 72a6eb9729)

Co-authored-by: softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
2026-05-18 10:18:52 +09:00
Hideki SaitoGitHubsoftwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
c163fb089e Merge pull request #670 from felixfontein/deprecations (#730)
Use module.warn() instead of returning warnings

SUMMARY
Returning warnings as warnings has been deprecated.
Ref: #635.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
firewalld_info
mount

Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit 6da1331018)

Co-authored-by: softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
2026-05-18 09:56:46 +09:00
e29860f4d2 Removed ANSIBLE_METADATA from remaining plugins (#717) (#729)
(cherry picked from commit 7cbef04377)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2026-05-18 09:21:23 +09:00
Hideki SaitoGitHubsoftwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
668015a48c Merge pull request #677 from shenxianpeng/patch-1 (#728)
docs: fix broken badge and restore coverage badge

SUMMARY
Replaced the outdated Shippable badge and active Codecov coverage badge, like other repos in ansible-collections org
ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit b39ee97ccc)

Co-authored-by: softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
2026-05-18 08:34:57 +09:00
947dacff6a Updated azure CI targets and readme (#713) (#727)
Added lastest branches and updated information
Normalized test versions to cover all supported ones

Apply suggestions from code review


(cherry picked from commit 0cc6be274c)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2026-05-18 07:49:31 +09:00
Hideki SaitoandGitHub 76af9b713e Backport #711 (#726)
Signed-off-by: Hideki Saito <saito@fgrep.org>
2026-05-18 03:36:08 +09:00
8f9c844b3d ci: add certification.yml GitHub workflow (#705) (#725)
(cherry picked from commit aece4a9632)

Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
2026-05-18 03:14:22 +09:00
d901769726 chore: remove .github/BOTMETA.yml (#706) (#723)
(cherry picked from commit 692b906b82)

Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
2026-05-18 02:31:07 +09:00
Hideki SaitoandGitHub cdce0f5218 Replace CI with the main branch (#722)
- Add 2.21 stages (Sanity, Docker, Remote)
- Update distro versions (Fedora 44, RHEL 10.1/9.7, FreeBSD 14.4/15.0)
- Remove CentOS 7 from Docker 2.16
- Add 2.21 to Summary stage dependencies
- Backport #718
2026-05-18 01:58:03 +09:00
softwarefactory-project-zuul[bot]andGitHub 8feac41f50 Merge pull request #694 from saito-hideki/pr/backport_693
[Backport][stable-2][CI] Update AZP CI matrix and sanity test

SUMMARY

Backporting #693
Backporting #682

ISSUE TYPE

CI tests Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-12-09 08:08:02 +00:00
saito-hideki 04274f4ce7 Ignore pylint errors caused by compatibility checks for six
* This is a temporary measure until we stop covering Python2
* Skipped sanity[cannot-ignore] to keep backward compatibility with Python2
* Consolidate all ansible-lint option locations into .ansible-lint
* Fixed some typos

Signed-off-by: saito-hideki <saito@fgrep.org>
(cherry picked from commit 9dc73a686a)
2025-12-09 07:32:44 +00:00
Hideki Saito 1bcf7f3ee4 Update AZP CI matrix and sanity test
* Update AZP CI matrix
* Add ignore file for Ansible Core 2.21
* Remove ignore lines for ansible-bad-import-from in 2.20 sanity tests

Signed-off-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit 7d5aef07e2)
2025-12-09 07:09:11 +00:00
softwarefactory-project-zuul[bot]andGitHub 30db9884ce Merge pull request #674 from saito-hideki/stable-2_pr673
[Backport][stable-2][AZP] #673

SUMMARY
This PR is a backport pull request for #673 to stable-2:

Addresses #672
Bump test container version 7.0.0
Removes Ansible Core 2.15 tests. Python 3.11 is no longer supported in Container 7.0.0.

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-08-08 00:41:00 +00:00
softwarefactory-project-zuul[bot]andHideki Saito d16e94f541 Merge pull request #673 from saito-hideki/pr/ci_update_20250805
[AZP] Update CI matrix

SUMMARY
Update AZP CI matrix:

Addresses #672
Bump test container version 7.0.0
Removes Ansible Core 2.15 tests. Python 3.11 is no longer supported in Container 7.0.0.

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-08-08 08:56:42 +09:00
softwarefactory-project-zuul[bot]andGitHub 535167e254 Merge pull request #668 from saito-hideki/stable-2_665
[Backport][stable-2] #665

SUMMARY
Update the README with the release of Ansible Core 2.19

#665

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
N/A
2025-07-29 05:39:58 +00:00
softwarefactory-project-zuul[bot]andsaito-hideki 6336671eba Merge pull request #665 from saito-hideki/pr/readme_20250728
Update README for release of Ansible Core 2.19

SUMMARY
README updated with the release of Ansible Core 2.19

https://docs.ansible.com/ansible/devel/roadmap/ROADMAP_2_19.html

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
N/A
2025-07-29 13:28:02 +09:00
softwarefactory-project-zuul[bot]andGitHub f7ed590388 Merge pull request #667 from saito-hideki/stable-2_666
[Backport][stable-2] #666

SUMMARY
Update AZP matrix to follow ansible-test changes:

#666

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-07-29 01:46:42 +00:00
softwarefactory-project-zuul[bot]andsaito-hideki 07c6e38679 Merge pull request #666 from saito-hideki/pr/azp_update_matrix_20250728
[AZP][CI] Update AZP matrix to follow ansible-test changes

SUMMARY
Update AZP matrix to follow ansible-test changes

ansible/ansible/pull/85558
ansible/ansible/pull/85561
ansible/ansible/pull/85562

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-07-29 09:27:05 +09:00
softwarefactory-project-zuul[bot]andGitHub f6663b7511 Merge pull request #661 from saito-hideki/stable-2
[stable-2][backport][AZP] Merge pull request #660

SUMMARY
[AZP] Fixed syntax error in AZP settings

cherry-pick #660

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-07-17 05:28:54 +00:00
Hideki Saito 8831aa205c Merge pull request #660 from saito-hideki/pr_azp_syntax
[AZP] Fixed syntax error in AZP settings

SUMMARY
Fixed syntax error in AZP settings

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-07-17 14:01:01 +09:00
softwarefactory-project-zuul[bot]andGitHub e54b8bf68f Merge pull request #658 from saito-hideki/release_2.1.0
Release 2.1.0 commit

SUMMARY
Release 2.1.0 commit

Release Plan #149

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
This will be merged on 17 July if there are no problems

Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Andrew Klychkov <aklychko@redhat.com>
2025-07-17 00:01:11 +00:00
saito-hideki d792d39716 Release 2.1.0 commit
Signed-off-by: saito-hideki <saito@fgrep.org>
2025-07-16 14:29:10 +09:00
softwarefactory-project-zuul[bot]andGitHub 9d3cb96f23 Merge pull request #653 from saito-hideki/stable-2
[Backport][stable-2] #650 #654

SUMMARY
Backporting #650 to stable-2

Ref: #635

Backporting #654 to stable-2
ISSUE TYPE

Bugfix Pull Request
Feature Pull Request
CI Pull Request

COMPONENT NAME

profile_roles
profile_tasks
CI
2025-07-10 01:39:25 +00:00
softwarefactory-project-zuul[bot]andsaito-hideki a27063e1dc Merge pull request #654 from saito-hideki/pr/bump_core_version_220
[CI] bump ansible-core version to 2.20 for devel branch

SUMMARY
Bump ansible-core version to 2.20 for devel branch.

Bump devel test to ansible-core 2.19
Add ansible-core 2.18 to the stable list

ISSUE TYPE

CI Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-07-10 10:08:07 +09:00
softwarefactory-project-zuul[bot]andsaito-hideki 2351c27339 Merge pull request #650 from felixfontein/callback
profile_* callbacks: avoid deprecated/deleted functions

SUMMARY
The profile_roles and profile_tasks callbacks define methods playbook_on_setup and playbook_on_stats which have been deleted/deprecated:

playbook_on_stats has been deprecated, v2_playbook_on_stats should be used instead (that one has already been there for many years: ansible/ansible@ba0e532 was added in 2015).
playbook_on_setup has been deleted (ansible/ansible@eec57ec), and its v2 variant was already deleted in 2017: ansible/ansible@59d5481

Ref: #635
ISSUE TYPE

Bugfix Pull Request
Feature Pull Request

COMPONENT NAME
profile_roles
profile_tasks

Reviewed-by: Abhijeet Kasurde
Reviewed-by: Hideki Saito <saito@fgrep.org>
2025-07-10 08:27:42 +09:00
softwarefactory-project-zuul[bot]andGitHub 5902dcab58 Merge pull request #648 from saito-hideki/stable-2
[Backport][stable-2][AZP] Update CI Matrix

SUMMARY
Update AZP CI Matrix.

Fixes #642
Backport #640
Backport #646

ISSUE TYPE

CI tests

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
N/A
2025-06-10 08:12:06 +00:00
softwarefactory-project-zuul[bot]andsaito-hideki 953577cdb7 Merge pull request #646 from saito-hideki/issue/642
[AZP] Add RHEL10 environment to CI matrix

SUMMARY
Add RHEL10 environment to CI matrix

Fixes #642

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
N/A
2025-06-10 16:29:58 +09:00
softwarefactory-project-zuul[bot]andsaito-hideki 59493f92aa Merge pull request #640 from Klaas-/Klaas-fixCI
Remove EOL FreeBSD 13.2 from CI

SUMMARY

CI seems to be failing for a month, reason is that freebsd 13.2 is no longer valid.
See ansible-collections/community.general#8607

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
CI

Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Hideki Saito <saito@fgrep.org>
2025-06-10 16:29:51 +09:00
softwarefactory-project-zuul[bot]andGitHub 20ea2f068e Merge pull request #632 from saito-hideki/stable-2
[stable-2] Backport: #631

SUMMARY
Fixes a bug related to updating the ansible-core devel branch.

Fixes incorrect load path for json module in cgroup_perf_recap
Remove unnecessary condition from seboolean integration tests
Optimize conditions for selinux integration tests
Fixes #630

ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ansible.posix.cgroup_perf_recap
ADDITIONAL INFORMATION
N/A
2025-04-17 02:13:06 +00:00
softwarefactory-project-zuul[bot]andHideki Saito 1f1d637b7f Merge pull request #631 from saito-hideki/issue/630
Fixes issue related to latest ansible-core devel branch

SUMMARY
Fixes a bug related to updating the ansible-core devel branch.

Fixes incorrect load path for json module in cgroup_perf_recap
Remove unnecessary condition from seboolean integration tests
Optimize conditions for selinux integration tests
Fixes #630

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ansible.posix.cgroup_perf_recap

ADDITIONAL INFORMATION
N/A
2025-04-17 10:50:09 +09:00
softwarefactory-project-zuul[bot]andGitHub 7128f64169 Merge pull request #627 from saito-hideki/stable-2
[stable-2] improve mount integration tests #613 

SUMMARY
Backporting pull request for #613
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ansible.posix.mount

ADDITIONAL INFORMATION
None
2025-04-10 07:18:11 +00:00
softwarefactory-project-zuul[bot]andHideki Saito 3149f38296 Merge pull request #613 from simonLeary42/rewrite-mount-tests
improve mount integration tests

SUMMARY

added check mode tests (assert no changes made)
added comments to make file less scary

ISSUE TYPE
tests
COMPONENT NAME
mount
ADDITIONAL INFORMATION

Reviewed-by: Abhijeet Kasurde
Reviewed-by: Hideki Saito <saito@fgrep.org>
2025-04-10 06:53:27 +00:00
softwarefactory-project-zuul[bot]andGitHub 8cc459f381 Merge pull request #623 from saito-hideki/stable-2
[AZP][stable-2] Update CI test environment

SUMMARY
[AZP][stable-2] Update CI test environment

Addresses #612

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2025-03-31 06:08:05 +00:00
Hideki Saito 82e4990f72 [AZP][stable-2] Update CI test environment
* Addresses #612

Signed-off-by: Hideki Saito <saito@fgrep.org>
2025-03-31 05:44:37 +00:00
Abhijeet KasurdeandHideki Saito 98f3e1255e [CI] update test containers
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-03-31 03:51:51 +00:00
softwarefactory-project-zuul[bot]andGitHub a004bd9494 Merge pull request #601 from saito-hideki/stable-2
Merge pull request #600 from release_2.0.0 commit

SUMMARY
Release 2.0.0 commit

Release Plan #149

ISSUE TYPE

Release Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2024-12-05 02:43:14 +00:00
softwarefactory-project-zuul[bot]andHideki Saito a357ceeb49 Merge pull request #600 from saito-hideki/release_2.0.0
Release 2.0.0 commit

SUMMARY
Release 2.0.0 commit

Release Plan #149

ISSUE TYPE
Feature Pull Request
COMPONENT NAME
ansible.posix
ADDITIONAL INFORMATION
This will be merged on 5 December if there are no problems

Reviewed-by: Adam Miller <admiller@redhat.com>
Reviewed-by: Andrew Klychkov <aklychko@redhat.com>
2024-12-05 10:56:19 +09:00
softwarefactory-project-zuul[bot]andGitHub e8fc89fe5a Merge pull request #599 from saito-hideki/stable-2
[Backport] cherrypick #597 and #598 to stable-2 branch

SUMMARY
Merge the following two PRs to stable-2 as a cherrypick

#598
#597

ISSUE TYPE

Backport Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
None
2024-12-03 03:47:04 +00:00
softwarefactory-project-zuul[bot]andHideki Saito ce72b7b1f4 Merge pull request #598 from saito-hideki/issue/586
[Breaking Change] [firewalld] Change type of icmp_block_inversion option from str to bool

SUMMARY
Changed the type of icmp_block_inversion option from str to bool

Fixes #586

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ansible.posix.firewalld

ADDITIONAL INFORMATION
Related  #582 and #584

Reviewed-by: Adam Miller <admiller@redhat.com>
Reviewed-by: Andrew Klychkov <aklychko@redhat.com>
2024-12-03 12:05:23 +09:00
softwarefactory-project-zuul[bot]andHideki Saito f61bb76a86 Merge pull request #597 from vbotka/mount-fix-comment
Remove comment from fstab entry on updating.

SUMMARY
Fix #595.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ansible.posix.mount
ADDITIONAL INFORMATION

Reviewed-by: Hideki Saito <saito@fgrep.org>
Reviewed-by: Vladimir Botka <vbotka@gmail.com>
2024-12-03 12:04:52 +09:00
58 changed files with 352 additions and 603 deletions
+43 -77
View File
@@ -59,22 +59,6 @@ stages:
- name: Lint
test: lint
- stage: Sanity_2_22
displayName: Ansible 2.22 Sanity & Units & Lint
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: "{0}"
testFormat: 2.22/{0}
targets:
- name: Sanity
test: sanity
- name: Units
test: units
- name: Lint
test: lint
- stage: Sanity_2_21
displayName: Ansible 2.21 Sanity & Units & Lint
dependsOn: []
@@ -175,8 +159,6 @@ stages:
test: lint
## Docker
# Valid docker targets are located at the following path:
# https://github.com/ansible/ansible/blob/<branch>/test/lib/ansible_test/_data/completion/docker.txt
- stage: Docker_devel
displayName: Docker devel
dependsOn: []
@@ -192,21 +174,6 @@ stages:
- name: Ubuntu 26.04
test: ubuntu2604
- stage: Docker_2_22
displayName: Docker 2.22
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: 2.22/linux/{0}/1
targets:
- name: Fedora 44
test: fedora44
- name: Ubuntu 24.04
test: ubuntu2404
- name: Ubuntu 26.04
test: ubuntu2604
- stage: Docker_2_21
displayName: Docker 2.21
dependsOn: []
@@ -296,8 +263,6 @@ stages:
test: ubuntu2204
## Remote
# Valid remote targets are located at the following path:
# https://github.com/ansible/ansible/blob/<branch>/test/lib/ansible_test/_data/completion/remote.txt
- stage: Remote_devel
displayName: Remote devel
dependsOn: []
@@ -305,28 +270,13 @@ stages:
- template: templates/matrix.yml
parameters:
testFormat: devel/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: FreeBSD 14.5
test: freebsd/14.5
- name: FreeBSD 15.1
test: freebsd/15.1
- stage: Remote_2_22
displayName: Remote 2.22
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: 2.22/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: RHEL 9.8
test: rhel/9.8
- name: FreeBSD 14.5
test: freebsd/14.5
- name: FreeBSD 14.4
test: freebsd/14.4
- name: FreeBSD 15.1
test: freebsd/15.1
@@ -338,14 +288,14 @@ stages:
parameters:
testFormat: 2.21/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: RHEL 9.8
test: rhel/9.8
- name: FreeBSD 14.5
test: freebsd/14.5
- name: FreeBSD 15.1
test: freebsd/15.1
- name: RHEL 10.1
test: rhel/10.1
- name: RHEL 9.7
test: rhel/9.7
- name: FreeBSD 14.4
test: freebsd/14.4
- name: FreeBSD 15.0
test: freebsd/15.0
- stage: Remote_2_20
displayName: Remote 2.20
@@ -355,12 +305,14 @@ stages:
parameters:
testFormat: 2.20/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: RHEL 9.8
test: rhel/9.8
- name: FreeBSD 14.5
test: freebsd/14.5
- name: RHEL 10.1
test: rhel/10.1
- name: RHEL 9.7
test: rhel/9.7
- name: FreeBSD 14.3
test: freebsd/14.3
- name: FreeBSD 13.5
test: freebsd/13.5
- stage: Remote_2_19
displayName: Remote 2.19
@@ -376,6 +328,8 @@ stages:
test: rhel/9.7
- name: FreeBSD 14.3
test: freebsd/14.3
- name: FreeBSD 13.5
test: freebsd/13.5
- stage: Remote_2_18
displayName: Remote 2.18
@@ -385,10 +339,26 @@ stages:
parameters:
testFormat: 2.18/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: RHEL 9.8
test: rhel/9.8
- name: RHEL 10.1
test: rhel/10.1
- name: RHEL 9.7
test: rhel/9.7
- name: FreeBSD 13.5
test: freebsd/13.5
- stage: Remote_2_17
displayName: Remote 2.17
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
container: legacy
testFormat: 2.17/{0}/1
targets:
- name: RHEL 10.0
test: rhel/10.0
- name: FreeBSD 13.5
test: freebsd/13.5
- stage: Remote_2_16
displayName: Remote 2.16
@@ -399,10 +369,8 @@ stages:
container: legacy
testFormat: 2.16/{0}/1
targets:
- name: RHEL 10.2
test: rhel/10.2
- name: RHEL 9.8
test: rhel/9.8
- name: RHEL 10.1
test: rhel/10.1
## Finally
@@ -413,6 +381,7 @@ stages:
- Remote_2_16
- Docker_2_16
- Sanity_2_17
- Remote_2_17
- Docker_2_17
- Sanity_2_18
- Remote_2_18
@@ -426,9 +395,6 @@ stages:
- Sanity_2_21
- Remote_2_21
- Docker_2_21
- Sanity_2_22
- Remote_2_22
- Docker_2_22
- Sanity_devel
- Remote_devel
- Docker_devel
+1 -1
View File
@@ -15,7 +15,7 @@ parameters:
jobs:
- ${{ each job in parameters.jobs }}:
- job: test_${{ replace(replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_'), '@', '_') }}
- job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
displayName: ${{ job.name }}
container: ${{ parameters.container }}
workspace:
-42
View File
@@ -1,42 +0,0 @@
# Security Policy
## Reporting a security vulnerability
All security vulnerability reports MUST be submitted by email to: [security@ansible.com](mailto:security@ansible.com)
Security vulnerabilities MUST NOT be reported through public channels such as GitHub issues, pull requests, the Ansible Forum, or social media.
## What to include
When submitting a vulnerability report, include the following:
* **Title** (required): Clear, concise, descriptive summary.
* **Impacted project** (required): Ideally a link to the GitHub project.
* **Reporter details** (optional): Your name or handle and affiliation.
* **Vulnerability description** (required): Technical details of the issue.
* **Affected versions** (required): Known affected version(s), and ideally all affected versions.
* **Reproduction steps** (required): Minimal example to reproduce the issue.
* **Impact assessment** (required): Potential exploit scenarios and severity.
* **Suggested fix** (optional): Proposed remediation, if any.
* **Disclosure status** (required): Whether this has been shared with other parties or published and your plan for future sharing (e.g., at a conference).
## Timeline
* The Ansible Security Team aims to confirm receipt of vulnerability reports within one (1) business day.
* Our goal is to assess the report, coordinate fix and disclosure as quickly as possible.
* All confirmed vulnerabilities are addressed according to severity and impact.
## Backports
Generally, only the latest release of this project receives security updates.
Earlier versions may receive critical fixes on a best-effort basis.
## Ansible Security Policy
For the complete Ansible Security Policy, including what qualifies as a reportable vulnerability, severity classification, the response process, coordinated disclosure, and the vulnerability management process, see [ansible.com/security](https://ansible.com/security).
## EU Cyber Resilience Act: Open-Source Steward Statement
This project is stewarded by **Red Hat, Inc.**, an open-source software steward as defined in Article 3(14) of the [EU Cyber Resilience Act (Regulation 2024/2847)](https://eur-lex.europa.eu/eli/reg/2024/2847/oj/eng).
Contact: [cra-steward@redhat.com](mailto:cra-steward@redhat.com)
+102
View File
@@ -4,6 +4,108 @@ ansible.posix Release Notes
.. contents:: Topics
v2.2.2
======
Release Summary
---------------
This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.2.1
Bugfixes
--------
- README - Added ``Red Hat Automation Hub`` as correct contact information for Red Hat Ansible Automation Platform subscribers.
v2.2.1
======
Release Summary
---------------
This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.2.0
Security Fixes
--------------
- authorized_key - fix local privilege escalation via symlink-following when running as root (https://github.com/ansible-collections/ansible.posix/issues/759).
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).
v2.2.0
======
Release Summary
---------------
This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.1.0
Minor Changes
-------------
- acl - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- authorized_key - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- cgroup_perf_recap callback - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- csh shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- firewalld_info - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- firewalld_info - use module.warn instead of passing ``warnings`` to ``exit_json`` (https://github.com/ansible-collections/ansible.posix/issues/710).
- fish shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- json callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- jsonl callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- mount - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- patch - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_roles callback - fix deprecated ``ansible.module_utils.six`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_tasks - Add option to provide a different date/time format (https://github.com/ansible-collections/ansible.posix/issues/279).
- profile_tasks callback - fix deprecated ``ansible.module_utils.six`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- removed ANSIBLE_METADATA from remaining plugins.
- rhel_rpm_ostree - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- rpm_ostree_upgrade - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- seboolean - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- synchronize - fix deprecated ``ansible.module_utils._text``, ``ansible.module_utils.common._collections_compat``, and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- sysctl - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
Bugfixes
--------
- acl - correctly assert needed changes when pointing to a directory and recursive is set to true.
- ansible.posix.authorized_key - fixes error on permission denied in authorized_key module (https://github.com/ansible-collections/ansible.posix/issues/462).
- firewalld_info - stop returning warnings as return values; this has been deprecated by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670).
- mount - stop returning warnings as return values; this has been deprecated by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670).
- patch - removed use of deprecated ``_AnsibleActionDone`` API (https://github.com/ansible-collections/ansible.posix/pull/687).
v2.1.0
======
Release Summary
---------------
This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.0.0
Minor Changes
-------------
- profile_tasks and profile_roles callback plugins - avoid deleted/deprecated callback functions, instead use modern interface that was introduced a longer time ago (https://github.com/ansible-collections/ansible.posix/issues/650).
Bugfixes
--------
- ansible.posix.cgroup_perf_recap - fixes json module load path (https://github.com/ansible-collections/ansible.posix/issues/630).
v2.0.0
======
+1 -2
View File
@@ -78,8 +78,7 @@ ansible-doc -t callback ansible.posix.profile_tasks
The following ansible-core versions have been tested with this collection:
- ansible-core 2.23 (devel)
- ansible-core 2.22 (stable)
- ansible-core 2.22 (devel)
- ansible-core 2.21 (stable)
- ansible-core 2.20 (stable)
- ansible-core 2.19 (stable)
+129
View File
@@ -490,3 +490,132 @@ releases:
- 597_remove_fstab_comment_on_updating.yml
- 598_icmp_block_inversion.yml
release_date: '2024-12-04'
2.1.0:
changes:
bugfixes:
- ansible.posix.cgroup_perf_recap - fixes json module load path (https://github.com/ansible-collections/ansible.posix/issues/630).
minor_changes:
- profile_tasks and profile_roles callback plugins - avoid deleted/deprecated
callback functions, instead use modern interface that was introduced a longer
time ago (https://github.com/ansible-collections/ansible.posix/issues/650).
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.0.0'
fragments:
- 2.1.0.yml
- 631_fixes_module_path.yml
- 642_ci_add_rhel10.yml
- 650-profile_tasks_roles.yml
- 654_ci_bump_core_version.yml
release_date: '2025-07-16'
2.2.0:
changes:
bugfixes:
- acl - correctly assert needed changes when pointing to a directory and recursive
is set to true.
- ansible.posix.authorized_key - fixes error on permission denied in authorized_key
module (https://github.com/ansible-collections/ansible.posix/issues/462).
- firewalld_info - stop returning warnings as return values; this has been deprecated
by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670).
- mount - stop returning warnings as return values; this has been deprecated
by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670).
- patch - removed use of deprecated ``_AnsibleActionDone`` API (https://github.com/ansible-collections/ansible.posix/pull/687).
minor_changes:
- acl - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- authorized_key - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six``
imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- cgroup_perf_recap callback - fix deprecated ``ansible.module_utils._text``
and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- csh shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- firewalld_info - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- firewalld_info - use module.warn instead of passing ``warnings`` to ``exit_json``
(https://github.com/ansible-collections/ansible.posix/issues/710).
- fish shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- json callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- jsonl callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- mount - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six``
imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- patch - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_roles callback - fix deprecated ``ansible.module_utils.six`` import
(https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_tasks - Add option to provide a different date/time format (https://github.com/ansible-collections/ansible.posix/issues/279).
- profile_tasks callback - fix deprecated ``ansible.module_utils.six`` import
(https://github.com/ansible-collections/ansible.posix/issues/686).
- removed ANSIBLE_METADATA from remaining plugins.
- rhel_rpm_ostree - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- rpm_ostree_upgrade - fix deprecated ``ansible.module_utils._text`` import
(https://github.com/ansible-collections/ansible.posix/issues/686).
- seboolean - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- synchronize - fix deprecated ``ansible.module_utils._text``, ``ansible.module_utils.common._collections_compat``,
and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- sysctl - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six``
imports (https://github.com/ansible-collections/ansible.posix/issues/686).
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.1.0'
fragments:
- 2.2.0.yml
- 626_profile_tasks_datetime_format.yml
- 638_fix_recursive_acl.yml
- 639_fix_authorized_key.yml
- 660_ci_azp_syntax.yml
- 665_update_readme_20250728.yml
- 666_azp_update_20250728.yml
- 670-deprecations.yml
- 673_update_ci_20250805.yml
- 682_update_ci_20250929.yml
- 686_fix_deprecated_imports.yml
- 693_azp_update_20251205.yml
- ansible_metadata_removed.yml
- firewalld_info_warnings.yml
- patch_removed.yml
release_date: '2026-05-18'
2.2.1:
changes:
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).
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.2.0'
security_fixes:
- authorized_key - fix local privilege escalation via symlink-following when
running as root (https://github.com/ansible-collections/ansible.posix/issues/759).
fragments:
- 2.2.1.yml
- 643-sysctl-docs.yml
- 751_ci_test_container_update.yml
- 755_ci_test_container_update.yml
- 759_cve_2026_11837.yml
- 763_ci_azp_update_devel.yml
- freebsd_sysctl.yml
release_date: '2026-07-01'
2.2.2:
changes:
bugfixes:
- README - Added ``Red Hat Automation Hub`` as correct contact information for
Red Hat Ansible Automation Platform subscribers.
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
This changelog contains all changes to the modules and plugins
in the stable-2 branch that have been added after the release of
``ansible.posix`` 2.2.1'
fragments:
- 2.2.2.yml
- 767_remove_unsupported_version_skip.yml
- 768_update_support_section.yml
release_date: '2026-07-08'
@@ -1,7 +0,0 @@
bugfixes:
- synchronize - fall back to ``ansible_host`` and ``ansible_password``/``ansible_ssh_pass``
from the current host's task vars when absent from the cached ``hostvars``
snapshot (for example when set via play-level ``vars:``), and correctly
template ``ansible_host`` before building the rsync destination, fixing
"Host not found" errors when ``ansible_host`` differs from
``inventory_hostname`` (https://github.com/ansible-collections/ansible.posix/issues/469).
@@ -1,2 +0,0 @@
trivial:
- Bump version to 3.0.0 for the next release (https://github.com/ansible-collections/ansible.posix/issues/603).
@@ -1,2 +0,0 @@
trivial:
- Remove ubuntu20.04 from CI tests (https://github.com/ansible-collections/ansible.posix/issues/612).
@@ -1,3 +0,0 @@
---
minor_changes:
- profile_tasks - Add option to provide a different date/time format (https://github.com/ansible-collections/ansible.posix/issues/279).
@@ -1,6 +0,0 @@
---
bugfixes:
- ansible.posix.cgroup_perf_recap - fixes json module load path (https://github.com/ansible-collections/ansible.posix/issues/630).
trivial:
- ansible.posix.seboolean - remove unnecessary condition from seboolean integration tests (https://github.com/ansible-collections/ansible.posix/issues/630).
- ansible.posix.selinux - optimize conditions for selinux integration tests (https://github.com/ansible-collections/ansible.posix/issues/630).
@@ -1,2 +0,0 @@
bugfixes:
- acl - correctly assert needed changes when pointing to a directory and recursive is set to true.
@@ -1,3 +0,0 @@
---
bugfixes:
- ansible.posix.authorized_key - fixes error on permission denied in authorized_key module (https://github.com/ansible-collections/ansible.posix/issues/462).
@@ -1,2 +0,0 @@
trivial:
- Add Red Hat Enterprise Linux 10.0 to the CI matrix (https://github.com/ansible-collections/ansible.posix/issues/642).
-3
View File
@@ -1,3 +0,0 @@
---
trivial:
- sysctl - added the attributes section to the module documentation to reflect check_mode support (https://github.com/ansible-collections/ansible.posix/issues/643).
@@ -1,2 +0,0 @@
minor_changes:
- "profile_tasks and profile_roles callback plugins - avoid deleted/deprecated callback functions, instead use modern interface that was introduced a longer time ago (https://github.com/ansible-collections/ansible.posix/issues/650)."
@@ -1,3 +0,0 @@
---
trivial:
- Bump ansible-core version to 2.20 of devel branch and add 2.19 to CI
@@ -1,2 +0,0 @@
trivial:
- AZP - fixed syntax error in CI test.
@@ -1,3 +0,0 @@
---
trivial:
- README - Update README to reflect Ansible Core 2.19 release.
@@ -1,3 +0,0 @@
---
trivial:
- AZP - Update AZP matrix to follow ansible-test changes.
@@ -1,3 +0,0 @@
bugfixes:
- "firewalld_info - stop returning warnings as return values; this has been deprecated by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670)."
- "mount - stop returning warnings as return values; this has been deprecated by ansible-core (https://github.com/ansible-collections/ansible.posix/pull/670)."
@@ -1,2 +0,0 @@
trivial:
- Update AZP CI matrix (https://github.com/ansible-collections/ansible.posix/issues/673).
@@ -1,4 +0,0 @@
bugfixes:
- firewalld_info - return a module failure instead of a traceback when python-firewall raises
``FirewallError``, for example when D-Bus is unavailable
(https://github.com/ansible-collections/ansible.posix/issues/678).
@@ -1,4 +0,0 @@
trivial:
- Updatng AZP CI matrix to ignore ansible-bad-import-from on six(https://github.com/ansible-collections/ansible.posix/pull/682).
- Skipped sanity[cannot-ignore] to keep backward compatibility with Python2.
- Consolidate all ansible-lint option locations into .ansible-lint file.
@@ -1,19 +0,0 @@
---
minor_changes:
- acl - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- authorized_key - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- cgroup_perf_recap callback - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- csh shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- firewalld_info - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- fish shell plugin - fix deprecated ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- json callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- jsonl callback - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- mount - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- patch - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_roles callback - fix deprecated ``ansible.module_utils.six`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- profile_tasks callback - fix deprecated ``ansible.module_utils.six`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- rhel_rpm_ostree - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- rpm_ostree_upgrade - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- seboolean - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
- synchronize - fix deprecated ``ansible.module_utils._text``, ``ansible.module_utils.common._collections_compat``, and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
- sysctl - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.six`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
@@ -1,5 +0,0 @@
---
trivial:
- AZP - Update AZP matrix to follow ansible-test changes.
- Add ignore file for Ansible Core 2.21.
- Remove ignore lines for ansible-bad-import-from in 2.20 sanity tests.
@@ -1,5 +0,0 @@
bugfixes:
- synchronize - report ``changed`` correctly when ``link_dest`` is used. Previously the module
reported no change as soon as rsync listed one unchanged file, even if other files were
transferred, deleted or had their attributes updated
(https://github.com/ansible-collections/ansible.posix/issues/716).
@@ -1,3 +0,0 @@
---
trivial:
- Update Azure Pipelines test container to 8.0.0 and use legacy container for ansible-core 2.16/2.17.
@@ -1,3 +0,0 @@
---
trivial:
- Replace AZP remote test FreeBSD-14.2 with 14.3 for Ansible Core 2.19.
@@ -1,2 +0,0 @@
security_fixes:
- authorized_key - fix local privilege escalation via symlink-following when running as root (https://github.com/ansible-collections/ansible.posix/issues/759).
@@ -1,3 +0,0 @@
---
trivial:
- Replace AZP remote test RHEL9.7 and RHEL10.1 with 9.8 and 10.2 for devel branch.
@@ -1,4 +0,0 @@
---
trivial:
- ansible-lint - Removed ``meta-runtime[unsupported-version]`` from the skip_list in ``.ansible-lint``.
...
@@ -1,4 +0,0 @@
---
bugfixes:
- README - Added ``Red Hat Automation Hub`` as correct contact information for Red Hat Ansible Automation Platform subscribers.
...
@@ -1,2 +0,0 @@
minor_changes:
- "Introduce an option to remove only the mount and fstab entry but not the mountpoint (https://github.com/ansible-collections/ansible.posix/issues/331)."
@@ -1,4 +0,0 @@
---
bugfixes:
- profile_tasks - fix incorrect ``version_added`` for ``datetime_format`` option(https://github.com/ansible-collections/ansible.posix/issues/783).
...
@@ -1,3 +0,0 @@
---
trivial:
- Fix mount opts_no_log integration test for ansible-core 2.22 (https://github.com/ansible-collections/ansible.posix/issues/793).
@@ -1,4 +0,0 @@
---
trivial:
- CI - AZP replace FreeBSD version 14.4 with 14.5 for remote tests.
...
@@ -1,5 +0,0 @@
---
trivial:
- CI - remove FreeBSD version 13.5 from AZP remote tests.
- CI - use Python 3.9 on RHEL 9.8 in AZP remote devel to keep compatibility with Python firewall library.
...
@@ -1,7 +0,0 @@
---
trivial:
- CI - Add ansible core 2.22 for AZP tests.
- CI - Update remote OS for AZP tests.
- CI - Remove 2.17 from AZP remote tests.
- CI - Fix the replacement logic for AZP test job parameter.
...
@@ -1,3 +0,0 @@
---
minor_changes:
- removed ANSIBLE_METADATA from remaining plugins.
@@ -1,3 +0,0 @@
---
minor_changes:
- firewalld_info - use module.warn instead of passing ``warnings`` to ``exit_json`` (https://github.com/ansible-collections/ansible.posix/issues/710).
-3
View File
@@ -1,3 +0,0 @@
---
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).
@@ -1,3 +0,0 @@
---
bugfixes:
- mount - restore fstab if umount fails (https://github.com/ansible-collections/ansible.posix/issues/605).
-3
View File
@@ -1,3 +0,0 @@
---
bugfixes:
- patch - removed use of deprecated ``_AnsibleActionDone`` API (https://github.com/ansible-collections/ansible.posix/pull/687).
+1 -1
View File
@@ -1,7 +1,7 @@
---
namespace: ansible
name: posix
version: 3.0.0
version: 2.2.2
readme: README.md
authors:
- Ansible (github.com/ansible)
+3 -13
View File
@@ -240,17 +240,10 @@ class ActionModule(ActionBase):
src_host = '127.0.0.1'
inventory_hostname = task_vars.get('inventory_hostname')
dest_host_inventory_vars = task_vars['hostvars'].get(inventory_hostname)
# If the user did not set ansible_host, ansible fills it in with the address
# of the delegate host when delegating, so only use ansible_host when not delegating.
dest_host = ((task_vars.get('ansible_host') if delegate_to is None else None)
or dest_host_inventory_vars.get('ansible_host')
or inventory_hostname)
if self._templar is not None:
dest_host = self._templar.template(dest_host)
dest_host = dest_host_inventory_vars.get('ansible_host', inventory_hostname)
dest_host_ids = [hostid for hostid in (dest_host_inventory_vars.get('inventory_hostname'),
dest_host_inventory_vars.get('ansible_host'),
dest_host)
dest_host_inventory_vars.get('ansible_host'))
if hostid is not None]
localhost_ports = set()
@@ -378,10 +371,7 @@ class ActionModule(ActionBase):
src = self._process_origin(src_host, src, user)
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
password = (task_vars.get('ansible_ssh_pass')
or task_vars.get('ansible_password')
or dest_host_inventory_vars.get('ansible_ssh_pass', None)
or dest_host_inventory_vars.get('ansible_password', None))
password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None)
if self._templar is not None:
password = self._templar.template(password)
else:
+1 -1
View File
@@ -62,7 +62,7 @@ DOCUMENTATION = '''
ini:
- section: callback_profile_tasks
key: datetime_format
version_added: 2.2.0
version_added: 3.0.0
truncate_task_names:
description:
- Truncate long task names in the TASKS RECAP summary with an ellipsis so rows stay within the terminal width.
-4
View File
@@ -224,11 +224,9 @@ except ImportError:
try:
import firewall.client as fw_client
import firewall.config as fw_config
import firewall.errors as fw_errors
HAS_FIREWALLD = True
except ImportError:
HAS_FIREWALLD = False
fw_errors = None
def get_version():
@@ -389,8 +387,6 @@ def main():
module.fail_json(msg=('Unable to gather firewalld settings.'
' You may need to run as the root user or'
' use become. (Error: %s)' % to_native(e)))
except fw_errors.FirewallError as e:
module.fail_json(msg='Unable to gather firewalld settings. (Error: %s)' % to_native(e))
result['collected_zones'] = collect_zones
result['undefined_zones'] = ignore_zones
+63 -91
View File
@@ -88,13 +88,6 @@ options:
fail if multiple devices are mounted on the same mount point. Using
V(absent) with a mount point that is not registered in the I(fstab) has
no effect, use V(unmounted) instead.
- V(absent_keep_mountpoint) specifies that the mount point entry O(path) will be removed
from I(fstab) and will also unmount the mounted device. The associated
mountpoint will not be removed. A mounted device will be unmounted regardless
of O(src) or its real source. V(absent_keep_mountpoint) does not unmount recursively,
and the module will fail if multiple devices are mounted on the same mount
point. Using V(absent_keep_mountpoint) with a mount point that is not registered in the
I(fstab) has no effect, use V(unmounted) instead.
- V(remounted) specifies that the device will be remounted for when you
want to force a refresh on the mount itself (added in 2.9). This will
always return RV(ignore:changed=true). If O(opts) is set, the options will be
@@ -109,7 +102,7 @@ options:
mountpoint.
type: str
required: true
choices: [ absent, absent_from_fstab, absent_keep_mountpoint, mounted, present, unmounted, remounted, ephemeral ]
choices: [ absent, absent_from_fstab, mounted, present, unmounted, remounted, ephemeral ]
fstab:
description:
- File to use instead of C(/etc/fstab).
@@ -177,11 +170,6 @@ EXAMPLES = r'''
path: /tmp/mnt-pnt
state: unmounted
- name: Unmount a mounted volume and remove its fstab entry
ansible.posix.mount:
path: /tmp/mnt-pnt
state: absent_keep_mountpoint
- name: Remount a mounted volume
ansible.posix.mount:
path: /tmp/mnt-pnt
@@ -241,14 +229,12 @@ from ansible.module_utils.common.text.converters import to_bytes, to_native
from ansible.module_utils.parsing.convert_bool import boolean
PLATFORM = platform.system().lower()
def write_fstab(module, lines, path):
backup_file = ""
if module.params['backup']:
backup_file = module.backup_local(path)
else:
backup_file = ""
fs_w = open(path, 'w')
@@ -271,7 +257,12 @@ def _escape_fstab(v):
if isinstance(v, int):
return v
return v.replace('\\', '\\134').replace(' ', '\\040').replace('&', '\\046')
else:
return (
v.
replace('\\', '\\134').
replace(' ', '\\040').
replace('&', '\\046'))
def set_mount(module, args):
@@ -290,7 +281,7 @@ def _set_mount_save_old(module, args):
escaped_args = dict([(k, _escape_fstab(v)) for k, v in args.items()])
new_line = '%(src)s %(name)s %(fstype)s %(opts)s %(dump)s %(passno)s\n'
if PLATFORM == 'sunos':
if platform.system() == 'SunOS':
new_line = (
'%(src)s - %(name)s %(fstype)s %(passno)s %(boot)s %(opts)s\n')
@@ -316,16 +307,16 @@ def _set_mount_save_old(module, args):
# Check if we got a valid line for splitting
# (on Linux the 5th and the 6th field is optional)
if (
PLATFORM == 'sunos' and len(fields) != 7 or
PLATFORM == 'linux' and len(fields) not in [4, 5, 6] or
PLATFORM not in ['sunos', 'linux'] and len(fields) != 6):
platform.system() == 'SunOS' and len(fields) != 7 or
platform.system() == 'Linux' and len(fields) not in [4, 5, 6] or
platform.system() not in ['SunOS', 'Linux'] and len(fields) != 6):
to_write.append(line)
continue
ld = {}
if PLATFORM == 'sunos':
if platform.system() == 'SunOS':
(
ld['src'],
dash,
@@ -363,7 +354,7 @@ def _set_mount_save_old(module, args):
exists = True
args_to_check = ('src', 'fstype', 'opts', 'dump', 'passno')
if PLATFORM == 'sunos':
if platform.system() == 'SunOS':
args_to_check = ('src', 'fstype', 'passno', 'boot', 'opts')
for t in args_to_check:
@@ -386,35 +377,35 @@ def _set_mount_save_old(module, args):
return (args['name'], old_lines, changed)
def unset_mount(module, args, backup=False):
def unset_mount(module, args):
"""Remove a mount point from fstab."""
to_write = []
changed = False
escaped_name = _escape_fstab(args['name'])
lines = open(args['fstab'], 'r').readlines()
for line in lines:
for line in open(args['fstab'], 'r').readlines():
if not line.strip():
to_write.append(line)
continue
if line.strip().startswith('#'):
to_write.append(line)
continue
line_fields = line.split()
# Check if we got a valid line for splitting
if (
PLATFORM == 'sunos' and len(line_fields) != 7 or
PLATFORM != 'sunos' and len(line_fields) != 6):
platform.system() == 'SunOS' and len(line.split()) != 7 or
platform.system() != 'SunOS' and len(line.split()) != 6):
to_write.append(line)
continue
ld = {}
if PLATFORM == 'sunos':
if platform.system() == 'SunOS':
(
ld['src'],
dash,
@@ -423,7 +414,7 @@ def unset_mount(module, args, backup=False):
ld['passno'],
ld['boot'],
ld['opts']
) = line_fields
) = line.split()
else:
(
ld['src'],
@@ -432,7 +423,7 @@ def unset_mount(module, args, backup=False):
ld['opts'],
ld['dump'],
ld['passno']
) = line_fields
) = line.split()
if (
ld['name'] != escaped_name or (
@@ -451,9 +442,7 @@ def unset_mount(module, args, backup=False):
if changed and not module.check_mode:
write_fstab(module, to_write, args['fstab'])
if backup:
return (args['name'], changed, lines)
return (args['name'], changed, [])
return (args['name'], changed)
def _set_fstab_args(fstab_file):
@@ -462,8 +451,8 @@ def _set_fstab_args(fstab_file):
if (
fstab_file and
fstab_file != '/etc/fstab' and
PLATFORM != 'sunos'):
if PLATFORM.endswith('bsd'):
platform.system().lower() != 'sunos'):
if platform.system().lower().endswith('bsd'):
result.append('-F')
else:
result.append('-T')
@@ -476,7 +465,7 @@ def _set_fstab_args(fstab_file):
def _set_ephemeral_args(args):
result = []
# Set fstype switch according to platform. SunOS/Solaris use -F
if PLATFORM == 'sunos':
if platform.system().lower() == 'sunos':
result.append('-F')
else:
result.append('-t')
@@ -498,7 +487,7 @@ def mount(module, args):
name = args['name']
cmd = [mount_bin]
if PLATFORM == 'openbsd':
if platform.system().lower() == 'openbsd':
# Use module.params['fstab'] here as args['fstab'] has been set to the
# default value.
if module.params['fstab'] is not None:
@@ -519,7 +508,8 @@ def mount(module, args):
if rc == 0:
return 0, ''
return rc, out + err
else:
return rc, out + err
def umount(module, path):
@@ -532,7 +522,8 @@ def umount(module, path):
if rc == 0:
return 0, ''
return rc, out + err
else:
return rc, out + err
def remount(module, args):
@@ -541,7 +532,7 @@ def remount(module, args):
cmd = [mount_bin]
# Multiplatform remount opts
if PLATFORM.endswith('bsd'):
if platform.system().lower().endswith('bsd'):
if module.params['state'] == 'remounted' and args['opts'] != 'defaults':
cmd += ['-u', '-o', args['opts']]
else:
@@ -552,7 +543,7 @@ def remount(module, args):
else:
cmd += ['-o', 'remount']
if PLATFORM == 'openbsd':
if platform.system().lower() == 'openbsd':
# Use module.params['fstab'] here as args['fstab'] has been set to the
# default value.
if module.params['fstab'] is not None:
@@ -571,7 +562,7 @@ def remount(module, args):
out = err = ''
try:
if module.params['state'] != 'ephemeral' and PLATFORM.endswith('bsd'):
if module.params['state'] != 'ephemeral' and platform.system().lower().endswith('bsd'):
# Note: Forcing BSDs to do umount/mount due to BSD remount not
# working as expected (suspect bug in the BSD mount command)
# Interested contributor could rework this to use mount options on
@@ -627,7 +618,7 @@ def is_bind_mounted(module, linux_mounts, dest, src=None, fstype=None):
is_mounted = False
if PLATFORM == 'linux' and linux_mounts is not None:
if platform.system() == 'Linux' and linux_mounts is not None:
if src is None:
# That's for unmounted/absent
if dest in linux_mounts:
@@ -741,7 +732,7 @@ def _is_same_mount_src(module, src, mountpoint, linux_mounts):
return False
# Treat Linux bind mounts
if PLATFORM == 'linux' and linux_mounts is not None:
if platform.system() == 'Linux' and linux_mounts is not None:
# For Linux bind mounts only: the mount command does not return
# the actual source for bind mounts, but the device of the source.
# is_bind_mounted() called with the 'src' parameter will return True if
@@ -786,20 +777,7 @@ def main():
passno=dict(type='str', no_log=False, default='0'),
src=dict(type='path'),
backup=dict(type='bool', default=False),
state={
'type': 'str',
'required': True,
'choices': [
'absent',
'absent_from_fstab',
'absent_keep_mountpoint',
'mounted',
'present',
'unmounted',
'remounted',
'ephemeral'
]
},
state=dict(type='str', required=True, choices=['absent', 'absent_from_fstab', 'mounted', 'present', 'unmounted', 'remounted', 'ephemeral']),
),
supports_check_mode=True,
required_if=(
@@ -818,35 +796,30 @@ def main():
# name, src, fstype, opts, dump, passno, state, fstab=/etc/fstab
# Note: Do not modify module.params['fstab'] as we need to know if the user
# explicitly specified it in mount() and remount()
args = dict(
name=module.params['path'],
)
if PLATFORM == 'sunos':
args.update(
dict(
opts='-',
passno='-',
fstab=module.params['fstab'],
boot='yes' if module.params['boot'] else 'no',
)
if platform.system().lower() == 'sunos':
args = dict(
name=module.params['path'],
opts='-',
passno='-',
fstab=module.params['fstab'],
boot='yes' if module.params['boot'] else 'no',
)
if args['fstab'] is None:
args['fstab'] = '/etc/vfstab'
else:
args.update(
dict(
opts='defaults',
dump='0',
passno='0',
fstab=module.params['fstab'],
boot='yes',
)
args = dict(
name=module.params['path'],
opts='defaults',
dump='0',
passno='0',
fstab=module.params['fstab'],
boot='yes',
)
if args['fstab'] is None:
args['fstab'] = '/etc/fstab'
# FreeBSD doesn't have any 'default' so set 'rw' instead
if PLATFORM == 'freebsd':
if platform.system() == 'FreeBSD':
args['opts'] = 'rw'
args['backup_file'] = ""
@@ -854,7 +827,7 @@ def main():
# Cache all mounts here in order we have consistent results if we need to
# call is_bind_mounted() multiple times
if PLATFORM == 'linux':
if platform.system() == 'Linux':
linux_mounts = get_linux_mounts(module)
if linux_mounts is None:
@@ -864,7 +837,7 @@ def main():
for key in ('src', 'fstype', 'passno', 'opts', 'dump', 'fstab'):
if module.params[key] is not None:
args[key] = module.params[key]
if PLATFORM == 'linux' or PLATFORM.endswith('bsd'):
if platform.system().lower() == 'linux' or platform.system().lower().endswith('bsd'):
# Linux, FreeBSD, NetBSD and OpenBSD have 'noauto' as mount option to
# handle mount on boot. To avoid mount option conflicts, if 'noauto'
# specified in 'opts', mount module will ignore 'boot'.
@@ -907,20 +880,19 @@ def main():
changed = False
if state == 'absent_from_fstab':
name, changed, _dummy = unset_mount(module, args, backup=False)
elif state == 'absent' or state == 'absent_keep_mountpoint':
name, changed, backup_lines = unset_mount(module, args, backup=True)
name, changed = unset_mount(module, args)
elif state == 'absent':
name, changed = unset_mount(module, args)
if changed and not module.check_mode:
if ismount(name) or is_bind_mounted(module, linux_mounts, name):
res, msg = umount(module, name)
if res:
# failed to unmount, restore fstab
write_fstab(module, backup_lines, args['fstab'])
module.fail_json(msg="Error unmounting %s: %s" % (name, msg))
module.fail_json(
msg="Error unmounting %s: %s" % (name, msg))
if os.path.exists(name) and state == 'absent':
if os.path.exists(name):
try:
os.rmdir(name)
except (OSError, IOError) as e:
@@ -1035,7 +1007,7 @@ def main():
# If the managed node is Solaris, convert the boot value type to Boolean
# to match the type of return value with the module argument.
if PLATFORM == 'sunos':
if platform.system().lower() == 'sunos':
args['boot'] = boolean(args['boot'])
module.exit_json(changed=changed, **args)
+2 -4
View File
@@ -632,10 +632,8 @@ def main():
return module.fail_json(msg=err, rc=rc, cmd=cmdstr)
if link_dest:
# -vv also itemizes unchanged items: a period, the file type, then
# spaces (e.g. '.f foo'). Every other itemized line is a change.
items = [line[len(changed_marker):] for line in out.splitlines() if line.startswith(changed_marker)]
changed = any(not (item.startswith('.') and item[2:3] == ' ') for item in items)
# a leading period indicates no change
changed = (changed_marker + '.') not in out
else:
changed = changed_marker in out
+5 -7
View File
@@ -12,12 +12,9 @@ __metaclass__ = type
DOCUMENTATION = r'''
---
module: sysctl
short_description: Manage sysctl entries
short_description: Manage entries in sysctl.conf.
description:
- This module manipulates sysctl entries and optionally performs a C(/sbin/sysctl -p) after changing them.
- If you are using C(systemd-sysctl(8)), note that it won't use the file C(/etc/sysctl.conf).
- If you are using C(procps) sysctl, it reads C(/etc/sysctl.conf).
- Read more about L(sysctl.conf, https://www.man7.org/linux/man-pages/man5/sysctl.conf.5.html).
version_added: "1.0.0"
options:
name:
@@ -44,14 +41,15 @@ options:
default: false
reload:
description:
- 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.
- 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:
description:
- Specifies the absolute path to sysctl file, if not C(/etc/sysctl.conf).
- Specifies the absolute path to C(sysctl.conf), if not C(/etc/sysctl.conf).
default: /etc/sysctl.conf
type: path
sysctl_set:
+1 -69
View File
@@ -297,17 +297,10 @@
when: ansible_system in ('FreeBSD', 'Linux')
register: dest_stat
- name: Check if the mountpoint still exists
ansible.builtin.stat:
path: '{{ output_dir }}/mount_dest'
when: ansible_system in ('FreeBSD', 'Linux')
register: mountpoint_stat
- name: Check that we did not unmount
ansible.builtin.assert:
that:
- unmount_result['changed']
- mountpoint_stat['stat']['exists']
- dest_stat['stat']['exists']
when: ansible_system in ('FreeBSD', 'Linux')
@@ -325,65 +318,10 @@
when: ansible_system in ('FreeBSD', 'Linux')
register: dest_stat
- name: Check that the mountpoint no longer exists
ansible.builtin.stat:
path: '{{ output_dir }}/mount_dest'
when: ansible_system in ('FreeBSD', 'Linux')
register: mountpoint_stat
- name: Check that we unmounted
ansible.builtin.assert:
that:
- unmount_result['changed']
- not mountpoint_stat['stat']['exists']
- not dest_stat['stat']['exists']
when: ansible_system in ('FreeBSD', 'Linux')
# unmount (absent_keep_mountpoint)
- name: Bind mount a filesystem (Linux)
ansible.posix.mount:
src: '{{ output_dir }}/mount_source'
name: '{{ output_dir }}/mount_dest'
state: mounted
fstype: None
opts: bind
when: ansible_system == 'Linux'
register: bind_result_linux
- name: Bind mount a filesystem (FreeBSD)
ansible.posix.mount:
src: '{{ output_dir }}/mount_source'
name: '{{ output_dir }}/mount_dest'
state: mounted
fstype: nullfs
when: ansible_system == 'FreeBSD'
register: bind_result_freebsd
- name: Unmount the bind mount while keeping the mountpoint
ansible.posix.mount:
name: '{{ output_dir }}/mount_dest'
state: absent_keep_mountpoint
when: ansible_system in ('Linux', 'FreeBSD')
register: unmount_result
- name: Make sure the file no longer exists in dest
ansible.builtin.stat:
path: '{{ output_dir }}/mount_dest/test_file'
when: ansible_system in ('FreeBSD', 'Linux')
register: dest_stat
- name: Check if the mountpoint still exists
ansible.builtin.stat:
path: '{{ output_dir }}/mount_dest'
when: ansible_system in ('FreeBSD', 'Linux')
register: mountpoint_stat
- name: Check that we unmounted and that the mountpoint still exists
ansible.builtin.assert:
that:
- (ansible_system == 'Linux' and bind_result_linux['changed']) or (ansible_system == 'FreeBSD' and bind_result_freebsd['changed'])
- unmount_result['changed']
- mountpoint_stat['stat']['exists']
- not dest_stat['stat']['exists']
when: ansible_system in ('FreeBSD', 'Linux')
@@ -1165,16 +1103,10 @@
opts: rw
opts_no_log: true
register: mount_info
- name: Assert opts_no_log option true (ansible-core < 2.22)
- name: Assert opts_no_log option true
ansible.builtin.assert:
that:
- mount_info.opts == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
when: ansible_version.full is ansible.builtin.version('2.22', '<')
- name: Assert opts_no_log option true (ansible-core >= 2.22)
ansible.builtin.assert:
that:
- mount_info.opts == 'rw'
when: ansible_version.full is ansible.builtin.version('2.22', '>=')
- name: Remount the FS with opts_no_log option false
ansible.posix.mount:
path: /tmp/myfs
@@ -299,102 +299,6 @@
- directory_a
- directory_b
- name: Setup - directories for link_dest change detection
ansible.builtin.file:
state: directory
path: "{{ output_dir }}/{{ item }}"
mode: "0750"
loop:
- link_dest_src
- link_dest_dst
- link_dest_base
- name: Setup - create source files for link_dest change detection
ansible.builtin.copy:
dest: "{{ output_dir }}/link_dest_src/{{ item }}"
mode: "0640"
content: hello world
loop:
- foo.txt
- bar.txt
# the module's output marker in a file name must not count as a change
- "<<CHANGED>>baz.txt"
- name: Synchronize a directory using link_dest
ansible.posix.synchronize:
src: "{{ output_dir }}/link_dest_src/"
dest: "{{ output_dir }}/link_dest_dst/"
link_dest:
- "{{ output_dir }}/link_dest_base"
register: sync_initial
delegate_to: "{{ inventory_hostname }}"
- name: Synchronize the same directory again using link_dest
ansible.posix.synchronize:
src: "{{ output_dir }}/link_dest_src/"
dest: "{{ output_dir }}/link_dest_dst/"
link_dest:
- "{{ output_dir }}/link_dest_base"
register: sync_unchanged
delegate_to: "{{ inventory_hostname }}"
- name: Change the content of one source file only
ansible.builtin.copy:
dest: "{{ output_dir }}/link_dest_src/bar.txt"
mode: "0640"
content: goodbye world
# rsync -vv still lists the unchanged foo.txt, which used to hide the change
- name: Synchronize using link_dest after a content change
ansible.posix.synchronize:
src: "{{ output_dir }}/link_dest_src/"
dest: "{{ output_dir }}/link_dest_dst/"
link_dest:
- "{{ output_dir }}/link_dest_base"
register: sync_content
delegate_to: "{{ inventory_hostname }}"
- name: Change the permissions of one source file only
ansible.builtin.file:
path: "{{ output_dir }}/link_dest_src/foo.txt"
mode: "0600"
- name: Synchronize using link_dest after a permission change
ansible.posix.synchronize:
src: "{{ output_dir }}/link_dest_src/"
dest: "{{ output_dir }}/link_dest_dst/"
link_dest:
- "{{ output_dir }}/link_dest_base"
register: sync_mode
delegate_to: "{{ inventory_hostname }}"
- name: Synchronize again using link_dest after the changes
ansible.posix.synchronize:
src: "{{ output_dir }}/link_dest_src/"
dest: "{{ output_dir }}/link_dest_dst/"
link_dest:
- "{{ output_dir }}/link_dest_base"
register: sync_unchanged_again
delegate_to: "{{ inventory_hostname }}"
- name: Ensure link_dest reports a change only when something changed
ansible.builtin.assert:
that:
- sync_initial is changed
- sync_unchanged is not changed
- sync_content is changed
- sync_mode is changed
- sync_unchanged_again is not changed
- name: Cleanup
ansible.builtin.file:
state: absent
path: "{{ output_dir }}/{{ item }}"
loop:
- link_dest_src
- link_dest_dst
- link_dest_base
- name: Setup - test for source with working dir with spaces in path
ansible.builtin.file:
state: directory
View File
@@ -1,20 +0,0 @@
---
# Test that ansible_host set via play-level vars: (present in task_vars but
# absent from the hostvars snapshot for the target host) is correctly used
# to build the rsync destination instead of falling back to inventory_hostname.
# Regression test for https://github.com/ansible-collections/ansible.posix/issues/469
fixtures:
taskvars_in: taskvars_in.json
taskvars_out: taskvars_out.json
connection:
transport: ssh
hostvars:
127.0.0.1: {}
::1: {}
localhost: {}
asserts:
- hasattr(SAM._connection, 'ismock')
- self.execute_called
- self.final_module_args['_local_rsync_path'] == 'rsync'
- self.final_module_args['src'] == '/tmp/deleteme'
- self.final_module_args['dest'] == 'root@el6host.example.org:/tmp/deleteme'
@@ -1,11 +0,0 @@
{
"inventory_hostname": "el6host",
"ansible_user": "root",
"ansible_host": "el6host.example.org",
"hostvars": {
"el6host": {}
},
"vars": {
"ansible_host": "el6host.example.org"
}
}
@@ -55,9 +55,6 @@ class TaskMock(object):
become_user = None
become_method = None
check_mode = False
delegate_to = None
diff = False
no_log = None
class StdinMock(object):
@@ -67,10 +64,6 @@ class StdinMock(object):
class ConnectionMock(object):
ismock = True
_play_context = None
always_pipeline_modules = False
become = None
has_pipelining = False
socket_path = None
# transport = 'ssh'
transport = None
_new_stdin = StdinMock()
@@ -128,9 +121,6 @@ class SynchronizeTester(object):
return {}
def runtest(self, fixturepath='fixtures/synchronize/basic'):
# Reset task and connection to avoid state leaking between tests
self.task = TaskMock()
self.connection = ConnectionMock()
metapath = os.path.join(fixturepath, 'meta.yaml')
with open(metapath, 'rb') as f:
@@ -224,15 +214,6 @@ class TestSynchronizeAction(unittest.TestCase):
x = SynchronizeTester()
x.runtest(fixturepath=os.path.join(self.fixturedir, 'basic'))
@patch('ansible_collections.ansible.posix.plugins.action.synchronize.connection_loader', FakePluginLoader)
def test_ansible_host_from_task_vars(self):
# ansible_host set only via play-level vars (present in top-level
# task_vars, absent from the hostvars snapshot for the target host)
# must still be used to build the rsync destination.
# Regression test for https://github.com/ansible-collections/ansible.posix/issues/469
x = SynchronizeTester()
x.runtest(fixturepath=os.path.join(self.fixturedir, 'ansible_host_from_task_vars'))
@patch('ansible_collections.ansible.posix.plugins.action.synchronize.connection_loader', FakePluginLoader)
def test_basic_become(self):
x = SynchronizeTester()