Ansible Collection for Posix
Find a file
softwarefactory-project-zuul[bot] 72a6eb9729
Merge pull request #639 from Klaas-/Klaas-fix_authorized_key
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>
2025-11-28 03:25:21 +00:00
.azure-pipelines Ignore pylint errors caused by compatibility checks for six 2025-10-02 14:02:56 +09:00
.github Remove skippy callback 2024-09-05 16:08:40 +09:00
changelogs Fixes #462 notice permission denied on authorized_key module 2025-10-21 10:00:12 +02:00
hacking Migrate hacking/cgroup_perf_recap_graph.py (#12) 2020-04-22 23:05:09 -05:00
meta AZP update CI matrix 2025-08-05 14:30:30 +09:00
plugins Fixes #462 notice permission denied on authorized_key module 2025-10-21 10:00:12 +02:00
tests change result.failed==True to result is failed in check_permissions.yml 2025-10-22 08:29:46 +02:00
.ansible-lint Ignore pylint errors caused by compatibility checks for six 2025-10-02 14:02:56 +09:00
.gitignore Update changelog generation configuration 2020-06-17 15:57:15 +05:30
bindep.txt bindep - install rsync on all EL variants 2023-02-22 20:07:25 -05:00
CHANGELOG.rst Release 2.0.0 commit 2024-12-04 09:46:44 +09:00
codecov.yml refactor to comply with current ansible-lint and sanity guidelines 2023-12-06 17:22:59 -06:00
COPYING Initial commit 2020-03-09 13:15:28 +00:00
galaxy.yml Bump version to 3.0.0 for the next release 2024-12-10 17:30:22 +09:00
PSF-license.txt Update with actual CPython 3.9.5 license. 2022-05-16 08:00:40 +02:00
README.md AZP update CI matrix 2025-08-05 14:30:30 +09:00
requirements.txt Remove sanity jobs from shippable 2020-06-16 19:46:58 -04:00
shippable.yml refactor to comply with current ansible-lint and sanity guidelines 2023-12-06 17:22:59 -06:00
test-requirements.txt Add support for running ansible-test unit in zuul 2020-06-17 09:34:36 -04:00

ansible.posix

Build Status Run Status

Communication

Description

An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and derivative Operating Systems.

Requirements

  • Python:
    • The Python interpreter version must meet Ansible Core's requirements.
  • Ansible Core:
    • ansible-core 2.16 or later

Installation

Before using this collection, you need to install it with the Ansible Galaxy command-line tool:

ansible-galaxy collection install ansible.posix

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

collections:
  - name: ansible.posix

Note that if you install any collections from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package. To upgrade the collection to the latest available version, run the following command:

ansible-galaxy collection install ansible.posix --upgrade

You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 2.0.0:

ansible-galaxy collection install ansible.posix:==2.0.0

See using Ansible collections for more details.

For more information about communication, see the Ansible communication guide.

Use Cases

You can see the general use-cases as an example by ansible-doc command like below.

For example, ansible.posix.firewalld module:

ansible-doc ansible.posix.firewalld

Also, if you want to confirm the plugins descriptions, you can follow the following option with ansible-doc command:

For example, ansible.posix.profile_tasks callback plugin:

ansible-doc -t callback ansible.posix.profile_tasks

Testing

The following ansible-core versions have been tested with this collection:

  • ansible-core 2.20 (devel)
  • ansible-core 2.19 (stable) *
  • ansible-core 2.18 (stable)
  • ansible-core 2.17 (stable)

Contributing

We welcome community contributions to this collection. For more details, see Contributing to Ansible-maintained collections for complete details.

Support

See Communication section.

Release Notes and Roadmap

See changelog for more details.

This document was written using the following template.

The README has been carefully prepared to cover the community template, but if you find any problems, please file a documentation issue.

License Information

GNU General Public License v3.0 or later.

See COPYING to see the full text.