From 9ccc24edf29112d29a58f2433f7567206d87f50b Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 7 Jun 2024 07:03:56 +0200 Subject: [PATCH 01/42] Add basic ansible-lint config. --- .ansible-lint | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..7f470fa --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,10 @@ +--- +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2024, Ansible Project + +skip_list: + - meta-runtime[unsupported-version] # Tis rule doesn't make any sense + - fqcn[deep] # This rule produces false positives for files in tests/unit/plugins/action/fixtures/ +exclude_paths: + - changelogs/ From a615b84bf79678dd7410db9100b871815e17af1b Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 7 Jun 2024 07:12:06 +0200 Subject: [PATCH 02/42] Add sanity ignore file for ansible-core devel 2.18. --- tests/sanity/ignore-2.18.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/sanity/ignore-2.18.txt diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt new file mode 100644 index 0000000..3cf68c0 --- /dev/null +++ b/tests/sanity/ignore-2.18.txt @@ -0,0 +1 @@ +tests/utils/shippable/timing.py shebang From 11f29eba6fca66847d5fcbb4be51617d255c3bc0 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 7 Jun 2024 11:38:13 +0200 Subject: [PATCH 03/42] Add ansible-core 2.17 to CI. --- .azure-pipelines/azure-pipelines.yml | 46 ++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index ad732a0..a81a888 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -57,6 +57,21 @@ stages: test: units - name: Lint test: lint + - stage: Sanity_2_17 + displayName: Ansible 2.17 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: 2.17/{0} + targets: + - name: Sanity + test: sanity + - name: Units + test: units + - name: Lint + test: lint - stage: Sanity_2_16 displayName: Ansible 2.16 sanity dependsOn: [] @@ -70,8 +85,6 @@ stages: test: sanity - name: Units test: units - - name: Lint - test: lint - stage: Sanity_2_15 displayName: Ansible 2.15 sanity dependsOn: [] @@ -113,6 +126,20 @@ stages: test: ubuntu2004 - name: Ubuntu 22.04 test: ubuntu2204 + - stage: Docker_2_17 + displayName: Docker 2.17 + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + testFormat: 2.17/linux/{0}/1 + targets: + - name: Fedora 39 + test: fedora39 + - name: Ubuntu 20.04 + test: ubuntu2004 + - name: Ubuntu 22.04 + test: ubuntu2204 - stage: Docker_2_16 displayName: Docker 2.16 dependsOn: [] @@ -180,6 +207,18 @@ stages: test: rhel/9.3 - name: FreeBSD 13.3 test: freebsd/13.3 + - stage: Remote_2_17 + displayName: Remote 2.17 + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + testFormat: 2.17/{0}/1 + targets: + - name: RHEL 9.3 + test: rhel/9.3 + - name: FreeBSD 13.3 + test: freebsd/13.3 - stage: Remote_2_16 displayName: Remote 2.16 dependsOn: [] @@ -240,6 +279,9 @@ stages: - Sanity_2_16 - Remote_2_16 - Docker_2_16 + - Sanity_2_17 + - Remote_2_17 + - Docker_2_17 - Sanity_devel - Remote_devel - Docker_devel From b976831cef8fcd7a69b3eef895713c76ec0e68c6 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 8 Jun 2024 13:59:15 +0200 Subject: [PATCH 04/42] Remove included RST files. --- README.md | 22 +- docs/ansible.posix.acl_module.rst | 346 -------- docs/ansible.posix.at_module.rst | 186 ----- docs/ansible.posix.authorized_key_module.rst | 480 ----------- docs/ansible.posix.firewalld_info_module.rst | 526 ------------- docs/ansible.posix.firewalld_module.rst | 521 ------------ docs/ansible.posix.mount_module.rst | 336 -------- docs/ansible.posix.patch_module.rst | 245 ------ docs/ansible.posix.rhel_facts_module.rst | 103 --- docs/ansible.posix.rhel_rpm_ostree_module.rst | 156 ---- ...nsible.posix.rpm_ostree_upgrade_module.rst | 175 ---- docs/ansible.posix.seboolean_module.rst | 151 ---- docs/ansible.posix.selinux_module.rst | 253 ------ docs/ansible.posix.synchronize_module.rst | 744 ------------------ docs/ansible.posix.sysctl_module.rst | 215 ----- 15 files changed, 1 insertion(+), 4458 deletions(-) delete mode 100644 docs/ansible.posix.acl_module.rst delete mode 100644 docs/ansible.posix.at_module.rst delete mode 100644 docs/ansible.posix.authorized_key_module.rst delete mode 100644 docs/ansible.posix.firewalld_info_module.rst delete mode 100644 docs/ansible.posix.firewalld_module.rst delete mode 100644 docs/ansible.posix.mount_module.rst delete mode 100644 docs/ansible.posix.patch_module.rst delete mode 100644 docs/ansible.posix.rhel_facts_module.rst delete mode 100644 docs/ansible.posix.rhel_rpm_ostree_module.rst delete mode 100644 docs/ansible.posix.rpm_ostree_upgrade_module.rst delete mode 100644 docs/ansible.posix.seboolean_module.rst delete mode 100644 docs/ansible.posix.selinux_module.rst delete mode 100644 docs/ansible.posix.synchronize_module.rst delete mode 100644 docs/ansible.posix.sysctl_module.rst diff --git a/README.md b/README.md index 3683489..d556096 100644 --- a/README.md +++ b/README.md @@ -15,27 +15,7 @@ This collection has been tested against following Ansible versions: **>=2.14**. ## Included content - - -### Modules -Name | Description ---- | --- -[ansible.posix.acl](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.acl_module.rst)|Set and retrieve file ACL information. -[ansible.posix.at](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.at_module.rst)|Schedule the execution of a command or script file via the at command -[ansible.posix.authorized_key](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.authorized_key_module.rst)|Adds or removes an SSH authorized key -[ansible.posix.firewalld](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.firewalld_module.rst)|Manage arbitrary ports/services with firewalld -[ansible.posix.firewalld_info](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.firewalld_info_module.rst)|Gather information about firewalld -[ansible.posix.mount](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.mount_module.rst)|Control active and configured mount points -[ansible.posix.patch](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.patch_module.rst)|Apply patch files using the GNU patch tool -[ansible.posix.rhel_facts](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.rhel_facts_module.rst)|Facts module to set or override RHEL specific facts. -[ansible.posix.rhel_rpm_ostree](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.rhel_rpm_ostree_module.rst)|Ensure packages exist in a RHEL for Edge rpm-ostree based system -[ansible.posix.rpm_ostree_upgrade](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.rpm_ostree_upgrade_module.rst)|Manage rpm-ostree upgrade transactions -[ansible.posix.seboolean](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.seboolean_module.rst)|Toggles SELinux booleans -[ansible.posix.selinux](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.selinux_module.rst)|Change policy and state of SELinux -[ansible.posix.synchronize](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.synchronize_module.rst)|A wrapper around rsync to make common tasks in your playbooks quick and easy -[ansible.posix.sysctl](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.sysctl_module.rst)|Manage entries in sysctl.conf. - - +Check out [Ansible Galaxy](https://galaxy.ansible.com/ui/repo/published/ansible/posix/content/) or [the Ansible documentation](https://docs.ansible.com/ansible/devel/collections/ansible/posix/) for all modules and plugins included in this collection. ## Installing this collection diff --git a/docs/ansible.posix.acl_module.rst b/docs/ansible.posix.acl_module.rst deleted file mode 100644 index 6a13d89..0000000 --- a/docs/ansible.posix.acl_module.rst +++ /dev/null @@ -1,346 +0,0 @@ -.. _ansible.posix.acl_module: - - -***************** -ansible.posix.acl -***************** - -**Set and retrieve file ACL information.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Set and retrieve file ACL information. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- default - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
If the target is a directory, setting this to true will make it the default ACL for entities created inside the directory.
-
Setting default to true causes an error if the path is a file.
-
-
- entity - -
- string -
-
- Default:
""
-
-
The actual user or group that the ACL applies to when matching entity types user or group are selected.
-
-
- entry - -
- string -
-
- -
DEPRECATED.
-
The ACL to set or remove.
-
This must always be quoted in the form of <etype>:<qualifier>:<perms>.
-
The qualifier may be empty for some types, but the type and perms are always required.
-
- can be used as placeholder when you do not care about permissions.
-
This is now superseded by entity, type and permissions fields.
-
-
- etype - -
- string -
-
-
    Choices: -
  • group
  • -
  • mask
  • -
  • other
  • -
  • user
  • -
-
-
The entity type of the ACL to apply, see setfacl documentation for more info.
-
-
- follow - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Whether to follow symlinks on the path if a symlink is encountered.
-
-
- path - -
- path - / required -
-
- -
The full path of the file or object.
-

aliases: name
-
-
- permissions - -
- string -
-
- -
The permissions to apply/remove can be any combination of r, w, x
-
(read, write and execute respectively), and X (execute permission if the file is a directory or already has execute permission for some user)
-
-
- recalculate_mask - -
- string -
-
-
    Choices: -
  • default ←
  • -
  • mask
  • -
  • no_mask
  • -
-
-
Select if and when to recalculate the effective right masks of the files.
-
See setfacl documentation for more info.
-
Incompatible with state=query.
-
-
- recursive - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Recursively sets the specified ACL.
-
Incompatible with state=query.
-
Alias recurse added in version 1.3.0.
-

aliases: recurse
-
-
- state - -
- string -
-
-
    Choices: -
  • absent
  • -
  • present
  • -
  • query ←
  • -
-
-
Define whether the ACL should be present or not.
-
The query state gets the current ACL without changing it, for use in register operations.
-
-
- use_nfsv4_acls - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Use NFSv4 ACLs instead of POSIX ACLs.
-
-
- - -Notes ------ - -.. note:: - - The ``acl`` module requires that ACLs are enabled on the target filesystem and that the ``setfacl`` and ``getfacl`` binaries are installed. - - As of Ansible 2.0, this module only supports Linux distributions. - - As of Ansible 2.3, the *name* option has been changed to *path* as default, but *name* still works as well. - - - -Examples --------- - -.. code-block:: yaml - - - name: Grant user Joe read access to a file - ansible.posix.acl: - path: /etc/foo.conf - entity: joe - etype: user - permissions: r - state: present - - - name: Removes the ACL for Joe on a specific file - ansible.posix.acl: - path: /etc/foo.conf - entity: joe - etype: user - state: absent - - - name: Sets default ACL for joe on /etc/foo.d/ - ansible.posix.acl: - path: /etc/foo.d/ - entity: joe - etype: user - permissions: rw - default: true - state: present - - - name: Same as previous but using entry shorthand - ansible.posix.acl: - path: /etc/foo.d/ - entry: default:user:joe:rw- - state: present - - - name: Obtain the ACL for a specific file - ansible.posix.acl: - path: /etc/foo.conf - register: acl_info - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- acl - -
- list -
-
success -
Current ACL on provided path (after changes, if any)
-
-
Sample:
-
['user::rwx', 'group::rwx', 'other::rwx']
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Brian Coca (@bcoca) -- Jérémie Astori (@astorije) diff --git a/docs/ansible.posix.at_module.rst b/docs/ansible.posix.at_module.rst deleted file mode 100644 index 3d731a2..0000000 --- a/docs/ansible.posix.at_module.rst +++ /dev/null @@ -1,186 +0,0 @@ -.. _ansible.posix.at_module: - - -**************** -ansible.posix.at -**************** - -**Schedule the execution of a command or script file via the at command** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Use this module to schedule a command or script file to run once in the future. -- All jobs are executed in the 'a' queue. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- at - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- command - -
- string -
-
- -
A command to be executed in the future.
-
-
- count - -
- integer -
-
- -
The count of units in the future to execute the command or script file.
-
-
- script_file - -
- string -
-
- -
An existing script file to be executed in the future.
-
-
- state - -
- string -
-
-
    Choices: -
  • absent
  • -
  • present ←
  • -
-
-
The state dictates if the command or script file should be evaluated as present(added) or absent(deleted).
-
-
- unique - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
If a matching job is present a new job will not be added.
-
-
- units - -
- string -
-
-
    Choices: -
  • minutes
  • -
  • hours
  • -
  • days
  • -
  • weeks
  • -
-
-
The type of units in the future to execute the command or script file.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Schedule a command to execute in 20 minutes as root - ansible.posix.at: - command: ls -d / >/dev/null - count: 20 - units: minutes - - - name: Match a command to an existing job and delete the job - ansible.posix.at: - command: ls -d / >/dev/null - state: absent - - - name: Schedule a command to execute in 20 minutes making sure it is unique in the queue - ansible.posix.at: - command: ls -d / >/dev/null - count: 20 - units: minutes - unique: true - - - - -Status ------- - - -Authors -~~~~~~~ - -- Richard Isaacson (@risaacson) diff --git a/docs/ansible.posix.authorized_key_module.rst b/docs/ansible.posix.authorized_key_module.rst deleted file mode 100644 index 53efe25..0000000 --- a/docs/ansible.posix.authorized_key_module.rst +++ /dev/null @@ -1,480 +0,0 @@ -.. _ansible.posix.authorized_key_module: - - -**************************** -ansible.posix.authorized_key -**************************** - -**Adds or removes an SSH authorized key** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Adds or removes SSH authorized keys for particular user accounts. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- comment - -
- string -
-
- -
Change the comment on the public key.
-
Rewriting the comment is useful in cases such as fetching it from GitHub or GitLab.
-
If no comment is specified, the existing comment will be kept.
-
-
- exclusive - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Whether to remove all other non-specified keys from the authorized_keys file.
-
Multiple keys can be specified in a single key string value by separating them by newlines.
-
This option is not loop aware, so if you use with_ , it will be exclusive per iteration of the loop.
-
If you want multiple keys in the file you need to pass them all to key in a single batch as mentioned above.
-
-
- follow - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Follow path symlink instead of replacing it.
-
-
- key - -
- string - / required -
-
- -
The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys).
-
-
- key_options - -
- string -
-
- -
A string of ssh key options to be prepended to the key in the authorized_keys file.
-
-
- manage_dir - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Whether this module should manage the directory of the authorized key file.
-
If set to true, the module will create the directory, as well as set the owner and permissions of an existing directory.
-
Be sure to set manage_dir=false if you are using an alternate directory for authorized_keys, as set with path, since you could lock yourself out of SSH access.
-
See the example below.
-
-
- path - -
- path -
-
- -
Alternate path to the authorized_keys file.
-
When unset, this value defaults to ~/.ssh/authorized_keys.
-
-
- state - -
- string -
-
-
    Choices: -
  • absent
  • -
  • present ←
  • -
-
-
Whether the given key (with the given key_options) should or should not be in the file.
-
-
- user - -
- string - / required -
-
- -
The username on the remote host whose authorized_keys file will be modified.
-
-
- validate_certs - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
This only applies if using a https url as the source of the keys.
-
If set to false, the SSL certificates will not be validated.
-
This should only set to false used on personally controlled sites using self-signed certificates as it avoids verifying the source site.
-
Prior to 2.1 the code worked as if this was set to true.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Set authorized key taken from file - ansible.posix.authorized_key: - user: charlie - state: present - key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" - - - name: Set authorized keys taken from url - ansible.posix.authorized_key: - user: charlie - state: present - key: https://github.com/charlie.keys - - - name: Set authorized keys taken from url using lookup - ansible.posix.authorized_key: - user: charlie - state: present - key: "{{ lookup('url', 'https://github.com/charlie.keys', split_lines=False) }}" - - - name: Set authorized key in alternate location - ansible.posix.authorized_key: - user: charlie - state: present - key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" - path: /etc/ssh/authorized_keys/charlie - manage_dir: false - - - name: Set up multiple authorized keys - ansible.posix.authorized_key: - user: deploy - state: present - key: '{{ item }}' - with_file: - - public_keys/doe-jane - - public_keys/doe-john - - - name: Set authorized key defining key options - ansible.posix.authorized_key: - user: charlie - state: present - key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" - key_options: 'no-port-forwarding,from="10.0.1.1"' - - - name: Set authorized key without validating the TLS/SSL certificates - ansible.posix.authorized_key: - user: charlie - state: present - key: https://github.com/user.keys - validate_certs: false - - - name: Set authorized key, removing all the authorized keys already set - ansible.posix.authorized_key: - user: root - key: "{{ lookup('file', 'public_keys/doe-jane') }}" - state: present - exclusive: true - - - name: Set authorized key for user ubuntu copying it from current user - ansible.posix.authorized_key: - user: ubuntu - state: present - key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- exclusive - -
- boolean -
-
success -
If the key has been forced to be exclusive or not.
-
-
-
- key - -
- string -
-
success -
The key that the module was running against.
-
-
Sample:
-
https://github.com/user.keys
-
-
- key_option - -
- string -
-
success -
Key options related to the key.
-
-
-
- keyfile - -
- string -
-
success -
Path for authorized key file.
-
-
Sample:
-
/home/user/.ssh/authorized_keys
-
-
- manage_dir - -
- boolean -
-
success -
Whether this module managed the directory of the authorized key file.
-
-
Sample:
-
True
-
-
- path - -
- string -
-
success -
Alternate path to the authorized_keys file
-
-
-
- state - -
- string -
-
success -
Whether the given key (with the given key_options) should or should not be in the file
-
-
Sample:
-
present
-
-
- unique - -
- boolean -
-
success -
Whether the key is unique
-
-
-
- user - -
- string -
-
success -
The username on the remote host whose authorized_keys file will be modified
-
-
Sample:
-
user
-
-
- validate_certs - -
- boolean -
-
success -
This only applies if using a https url as the source of the keys. If set to false, the SSL certificates will not be validated.
-
-
Sample:
-
True
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Ansible Core Team diff --git a/docs/ansible.posix.firewalld_info_module.rst b/docs/ansible.posix.firewalld_info_module.rst deleted file mode 100644 index 911acce..0000000 --- a/docs/ansible.posix.firewalld_info_module.rst +++ /dev/null @@ -1,526 +0,0 @@ -.. _ansible.posix.firewalld_info_module: - - -**************************** -ansible.posix.firewalld_info -**************************** - -**Gather information about firewalld** - - - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- This module gathers information about firewalld rules. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- firewalld >= 0.2.11 -- python-firewall -- python-dbus - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- active_zones - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Gather information about active zones.
-
-
- zones - -
- list - / elements=string -
-
- -
Gather information about specific zones.
-
If only works if active_zones is set to false.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Gather information about active zones - ansible.posix.firewalld_info: - active_zones: true - register: result - - - name: Print default zone for debugging - ansible.builtin.debug: - var: result.firewalld_info.default_zone - - - name: Gather information about specific zones - ansible.posix.firewalld_info: - zones: - - public - - external - - internal - register: result - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- active_zones - -
- boolean -
-
success -
Gather active zones only if turn it true.
-
-
-
- collected_zones - -
- list -
-
success -
A list of collected zones.
-
-
Sample:
-
['external', 'internal']
-
-
- firewalld_info - -
- complex -
-
success -
Returns various information about firewalld configuration.
-
-
  -
- default_zone - -
- string -
-
success -
The zone name of default zone.
-
-
Sample:
-
public
-
  -
- version - -
- string -
-
success -
The version information of firewalld.
-
-
Sample:
-
0.8.2
-
  -
- zones - -
- complex -
-
success -
A dict of zones to gather information.
-
-
   -
- zone - -
- complex -
-
success -
The zone name registered in firewalld.
-
-
Sample:
-
external
-
    -
- forward - -
- boolean -
-
success -
The network interface forwarding.
-
This parameter supports on python-firewall 0.9.0(or later) and is not collected in earlier versions.
-
-
    -
- forward_ports - -
- list -
-
success -
A list of forwarding port pair with protocol.
-
-
Sample:
-
['icmp', 'ipv6-icmp']
-
    -
- icmp_block_inversion - -
- boolean -
-
success -
The ICMP block inversion to block all ICMP requests.
-
-
    -
- icmp_blocks - -
- list -
-
success -
A list of blocking icmp protocol.
-
-
Sample:
-
['echo-request']
-
    -
- interfaces - -
- list -
-
success -
A list of network interfaces.
-
-
Sample:
-
['eth0', 'eth1']
-
    -
- masquerade - -
- boolean -
-
success -
The network interface masquerading.
-
-
    -
- ports - -
- list -
-
success -
A list of network port with protocol.
-
-
Sample:
-
[['22', 'tcp'], ['80', 'tcp']]
-
    -
- protocols - -
- list -
-
success -
A list of network protocol.
-
-
Sample:
-
['icmp', 'ipv6-icmp']
-
    -
- rich_rules - -
- list -
-
success -
A list of rich language rule.
-
-
Sample:
-
['rule protocol value="icmp" reject', 'rule priority="32767" reject']
-
    -
- services - -
- list -
-
success -
A list of network services.
-
-
Sample:
-
['dhcp', 'dns', 'ssh']
-
    -
- source_ports - -
- list -
-
success -
A list of network source port with protocol.
-
-
Sample:
-
[['30000', 'tcp'], ['30001', 'tcp']]
-
    -
- sources - -
- list -
-
success -
A list of source network address.
-
-
Sample:
-
['172.16.30.0/24', '172.16.31.0/24']
-
    -
- target - -
- string -
-
success -
A list of services in the zone.
-
-
Sample:
-
ACCEPT
-
-
- undefined_zones - -
- list -
-
success -
A list of undefined zones in zones option.
-
undefined_zones will be ignored for gathering process.
-
-
Sample:
-
['foo', 'bar']
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Hideki Saito (@saito-hideki) diff --git a/docs/ansible.posix.firewalld_module.rst b/docs/ansible.posix.firewalld_module.rst deleted file mode 100644 index 0932ac2..0000000 --- a/docs/ansible.posix.firewalld_module.rst +++ /dev/null @@ -1,521 +0,0 @@ -.. _ansible.posix.firewalld_module: - - -*********************** -ansible.posix.firewalld -*********************** - -**Manage arbitrary ports/services with firewalld** - - - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- This module allows for addition or deletion of services and ports (either TCP or UDP) in either running or permanent firewalld rules. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- firewalld >= 0.2.11 -- python-firewall >= 0.2.11 - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- icmp_block - -
- string -
-
- -
The ICMP block you would like to add/remove to/from a zone in firewalld.
-
-
- icmp_block_inversion - -
- string -
-
- -
Enable/Disable inversion of ICMP blocks for a zone in firewalld.
-
-
- immediate - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Should this configuration be applied immediately, if set as permanent.
-
-
- interface - -
- string -
-
- -
The interface you would like to add/remove to/from a zone in firewalld.
-
-
- masquerade - -
- string -
-
- -
The masquerade setting you would like to enable/disable to/from zones within firewalld.
-
-
- offline - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Whether to run this module even when firewalld is offline.
-
-
- permanent - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Should this configuration be in the running firewalld configuration or persist across reboots.
-
As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9).
-
Note that if this is false, immediate is assumed true.
-
-
- port - -
- string -
-
- -
Name of a port or port range to add/remove to/from firewalld.
-
Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port ranges.
-
-
- port_forward - -
- list - / elements=dictionary -
-
- -
Port and protocol to forward using firewalld.
-
-
- port - -
- string - / required -
-
- -
Source port to forward from
-
-
- proto - -
- string - / required -
-
-
    Choices: -
  • udp
  • -
  • tcp
  • -
-
-
protocol to forward
-
-
- toaddr - -
- string -
-
- -
Optional address to forward to
-
-
- toport - -
- string - / required -
-
- -
destination port
-
-
- protocol - -
- string -
-
- -
Name of a protocol to add/remove to/from firewalld.
-
-
- rich_rule - -
- string -
-
- -
Rich rule to add/remove to/from firewalld.
- -
-
- service - -
- string -
-
- -
Name of a service to add/remove to/from firewalld.
-
The service must be listed in output of firewall-cmd --get-services.
-
-
- source - -
- string -
-
- -
The source/network you would like to add/remove to/from firewalld.
-
-
- state - -
- string - / required -
-
-
    Choices: -
  • absent
  • -
  • disabled
  • -
  • enabled
  • -
  • present
  • -
-
-
Enable or disable a setting.
-
For ports: Should this port accept (enabled) or reject (disabled) connections.
-
The states present and absent can only be used in zone level operations (i.e. when no other parameters but zone and state are set).
-
-
- target - -
- string -
-
added in 1.2.0
-
-
    Choices: -
  • default
  • -
  • ACCEPT
  • -
  • DROP
  • -
  • %%REJECT%%
  • -
-
-
firewalld Zone target
-
If state is set to absent, this will reset the target to default
-
-
- timeout - -
- integer -
-
- Default:
0
-
-
The amount of time in seconds the rule should be in effect for when non-permanent.
-
-
- zone - -
- string -
-
- -
The firewalld zone to add/remove to/from.
-
Note that the default zone can be configured per system but public is default from upstream.
-
Available choices can be extended based on per-system configs, listed here are "out of the box" defaults.
-
Possible values include block, dmz, drop, external, home, internal, public, trusted, work.
-
-
- - -Notes ------ - -.. note:: - - Not tested on any Debian based system. - - Requires the python2 bindings of firewalld, which may not be installed by default. - - For distributions where the python2 firewalld bindings are unavailable (e.g Fedora 28 and later) you will have to set the ansible_python_interpreter for these hosts to the python3 interpreter path and install the python3 bindings. - - Zone transactions (creating, deleting) can be performed by using only the zone and state parameters "present" or "absent". Note that zone transactions must explicitly be permanent. This is a limitation in firewalld. This also means that you will have to reload firewalld after adding a zone that you wish to perform immediate actions on. The module will not take care of this for you implicitly because that would undo any previously performed immediate actions which were not permanent. Therefore, if you require immediate access to a newly created zone it is recommended you reload firewalld immediately after the zone creation returns with a changed state and before you perform any other immediate, non-permanent actions on that zone. - - This module needs ``python-firewall`` or ``python3-firewall`` on managed nodes. It is usually provided as a subset with ``firewalld`` from the OS distributor for the OS default Python interpreter. - - - -Examples --------- - -.. code-block:: yaml - - - name: permit traffic in default zone for https service - ansible.posix.firewalld: - service: https - permanent: true - state: enabled - - - name: permit ospf traffic - ansible.posix.firewalld: - protocol: ospf - permanent: true - state: enabled - - - name: do not permit traffic in default zone on port 8081/tcp - ansible.posix.firewalld: - port: 8081/tcp - permanent: true - state: disabled - - - ansible.posix.firewalld: - port: 161-162/udp - permanent: true - state: enabled - - - ansible.posix.firewalld: - zone: dmz - service: http - permanent: true - state: enabled - - - ansible.posix.firewalld: - rich_rule: rule service name="ftp" audit limit value="1/m" accept - permanent: true - state: enabled - - - ansible.posix.firewalld: - source: 192.0.2.0/24 - zone: internal - state: enabled - - - ansible.posix.firewalld: - zone: trusted - interface: eth2 - permanent: true - state: enabled - - - ansible.posix.firewalld: - masquerade: true - state: enabled - permanent: true - zone: dmz - - - ansible.posix.firewalld: - zone: custom - state: present - permanent: true - - - ansible.posix.firewalld: - zone: drop - state: enabled - permanent: true - icmp_block_inversion: true - - - ansible.posix.firewalld: - zone: drop - state: enabled - permanent: true - icmp_block: echo-request - - - ansible.posix.firewalld: - zone: internal - state: present - permanent: true - target: ACCEPT - - - name: Redirect port 443 to 8443 with Rich Rule - ansible.posix.firewalld: - rich_rule: rule family=ipv4 forward-port port=443 protocol=tcp to-port=8443 - zone: public - permanent: true - immediate: true - state: enabled - - - - -Status ------- - - -Authors -~~~~~~~ - -- Adam Miller (@maxamillion) diff --git a/docs/ansible.posix.mount_module.rst b/docs/ansible.posix.mount_module.rst deleted file mode 100644 index f38621f..0000000 --- a/docs/ansible.posix.mount_module.rst +++ /dev/null @@ -1,336 +0,0 @@ -.. _ansible.posix.mount_module: - - -******************* -ansible.posix.mount -******************* - -**Control active and configured mount points** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- This module controls active and configured mount points in ``/etc/fstab``. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- backup - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
-
-
- boot - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Determines if the filesystem should be mounted on boot.
-
Only applies to Solaris and Linux systems.
-
For Solaris systems, true will set yes as the value of mount at boot in /etc/vfstab.
-
For Linux, FreeBSD, NetBSD and OpenBSD systems, false will add noauto to mount options in /etc/fstab.
-
To avoid mount option conflicts, if noauto specified in opts, mount module will ignore boot.
-
This parameter is ignored when state is set to ephemeral.
-
-
- dump - -
- string -
-
- Default:
"0"
-
-
Dump (see fstab(5)).
-
Note that if set to null and state set to present, it will cease to work and duplicate entries will be made with subsequent runs.
-
Has no effect on Solaris systems or when used with ephemeral.
-
-
- fstab - -
- string -
-
- -
File to use instead of /etc/fstab.
-
You should not use this option unless you really know what you are doing.
-
This might be useful if you need to configure mountpoints in a chroot environment.
-
OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem.
-
This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.
-
This parameter is ignored when state is set to ephemeral.
-
-
- fstype - -
- string -
-
- -
Filesystem type.
-
Required when state is present, mounted or ephemeral.
-
-
- opts - -
- string -
-
- -
Mount options (see fstab(5), or vfstab(4) on Solaris).
-
-
- passno - -
- string -
-
- Default:
"0"
-
-
Passno (see fstab(5)).
-
Note that if set to null and state set to present, it will cease to work and duplicate entries will be made with subsequent runs.
-
Deprecated on Solaris systems. Has no effect when used with ephemeral.
-
-
- path - -
- path - / required -
-
- -
Path to the mount point (e.g. /mnt/files).
-
Before Ansible 2.3 this option was only usable as dest, destfile and name.
-

aliases: name
-
-
- src - -
- path -
-
- -
Device (or NFS volume, or something else) to be mounted on path.
-
Required when state set to present, mounted or ephemeral.
-
-
- state - -
- string - / required -
-
-
    Choices: -
  • absent
  • -
  • absent_from_fstab
  • -
  • mounted
  • -
  • present
  • -
  • unmounted
  • -
  • remounted
  • -
  • ephemeral
  • -
-
-
If mounted, the device will be actively mounted and appropriately configured in fstab. If the mount point is not present, the mount point will be created.
-
If unmounted, the device will be unmounted without changing fstab.
-
present only specifies that the device is to be configured in fstab and does not trigger or require a mount.
-
ephemeral only specifies that the device is to be mounted, without changing fstab. If it is already mounted, a remount will be triggered. This will always return changed=True. If the mount point path has already a device mounted on, and its source is different than src, the module will fail to avoid unexpected unmount or mount point override. If the mount point is not present, the mount point will be created. The fstab is completely ignored. This option is added in version 1.5.0.
-
absent specifies that the device mount's entry will be removed from fstab and will also unmount the device and remove the mount point.
-
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 changed=true. If opts is set, the options will be applied to the remount, but will not change fstab. Additionally, if opts is set, and the remount command fails, the module will error to prevent unexpected mount changes. Try using mounted instead to work around this issue. remounted expects the mount point to be present in the fstab. To remount a mount point not registered in fstab, use ephemeral instead, especially with BSD nodes.
-
absent_from_fstab specifies that the device mount's entry will be removed from fstab. This option does not unmount it or delete the mountpoint.
-
-
- - -Notes ------ - -.. note:: - - As of Ansible 2.3, the *name* option has been changed to *path* as default, but *name* still works as well. - - Using ``remounted`` with *opts* set may create unexpected results based on the existing options already defined on mount, so care should be taken to ensure that conflicting options are not present before hand. - - - -Examples --------- - -.. code-block:: yaml - - # Before 2.3, option 'name' was used instead of 'path' - - name: Mount DVD read-only - ansible.posix.mount: - path: /mnt/dvd - src: /dev/sr0 - fstype: iso9660 - opts: ro,noauto - state: present - - - name: Mount up device by label - ansible.posix.mount: - path: /srv/disk - src: LABEL=SOME_LABEL - fstype: ext4 - state: present - - - name: Mount up device by UUID - ansible.posix.mount: - path: /home - src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077 - fstype: xfs - opts: noatime - state: present - - - name: Unmount a mounted volume - ansible.posix.mount: - path: /tmp/mnt-pnt - state: unmounted - - - name: Remount a mounted volume - ansible.posix.mount: - path: /tmp/mnt-pnt - state: remounted - - # The following will not save changes to fstab, and only be temporary until - # a reboot, or until calling "state: unmounted" followed by "state: mounted" - # on the same "path" - - name: Remount a mounted volume and append exec to the existing options - ansible.posix.mount: - path: /tmp - state: remounted - opts: exec - - - name: Mount and bind a volume - ansible.posix.mount: - path: /system/new_volume/boot - src: /boot - opts: bind - state: mounted - fstype: none - - - name: Mount an NFS volume - ansible.posix.mount: - src: 192.168.1.100:/nfs/ssd/shared_data - path: /mnt/shared_data - opts: rw,sync,hard - state: mounted - fstype: nfs - - - name: Mount NFS volumes with noauto according to boot option - ansible.posix.mount: - src: 192.168.1.100:/nfs/ssd/shared_data - path: /mnt/shared_data - opts: rw,sync,hard - boot: false - state: mounted - fstype: nfs - - - name: Mount ephemeral SMB volume - ansible.posix.mount: - src: //192.168.1.200/share - path: /mnt/smb_share - opts: "rw,vers=3,file_mode=0600,dir_mode=0700,dom={{ ad_domain }},username={{ ad_username }},password={{ ad_password }}" - fstype: cifs - state: ephemeral - - - - -Status ------- - - -Authors -~~~~~~~ - -- Ansible Core Team -- Seth Vidal (@skvidal) diff --git a/docs/ansible.posix.patch_module.rst b/docs/ansible.posix.patch_module.rst deleted file mode 100644 index 07f672a..0000000 --- a/docs/ansible.posix.patch_module.rst +++ /dev/null @@ -1,245 +0,0 @@ -.. _ansible.posix.patch_module: - - -******************* -ansible.posix.patch -******************* - -**Apply patch files using the GNU patch tool** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Apply patch files using the GNU patch tool. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- backup - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Passes --backup --version-control=numbered to patch, producing numbered backup copies.
-
-
- basedir - -
- path -
-
- -
Path of a base directory in which the patch file will be applied.
-
May be omitted when dest option is specified, otherwise required.
-
-
- binary - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Setting to true will disable patch's heuristic for transforming CRLF line endings into LF.
-
Line endings of src and dest must match.
-
If set to false, patch will replace CRLF in src files on POSIX.
-
-
- dest - -
- path -
-
- -
Path of the file on the remote machine to be patched.
-
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified with this option.
-

aliases: originalfile
-
-
- ignore_whitespace - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Setting to true will ignore white space changes between patch and input.
-
-
- remote_src - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
If false, it will search for src at originating/controller machine, if true it will go to the remote/target machine for the src.
-
-
- src - -
- path - / required -
-
- -
Path of the patch file as accepted by the GNU patch tool. If remote_src is false, the patch source file is looked up from the module's files directory.
-

aliases: patchfile
-
-
- state - -
- string -
-
-
    Choices: -
  • absent
  • -
  • present ←
  • -
-
-
Whether the patch should be applied or reverted.
-
-
- strip - -
- integer -
-
- Default:
0
-
-
Number that indicates the smallest prefix containing leading slashes that will be stripped from each file name found in the patch file.
-
For more information see the strip parameter of the GNU patch tool.
-
-
- - -Notes ------ - -.. note:: - - This module requires GNU *patch* utility to be installed on the remote host. - - - -Examples --------- - -.. code-block:: yaml - - - name: Apply patch to one file - ansible.posix.patch: - src: /tmp/index.html.patch - dest: /var/www/index.html - - - name: Apply patch to multiple files under basedir - ansible.posix.patch: - src: /tmp/customize.patch - basedir: /var/www - strip: 1 - - - name: Revert patch to one file - ansible.posix.patch: - src: /tmp/index.html.patch - dest: /var/www/index.html - state: absent - - - - -Status ------- - - -Authors -~~~~~~~ - -- Jakub Jirutka (@jirutka) -- Luis Alberto Perez Lazaro (@luisperlaz) diff --git a/docs/ansible.posix.rhel_facts_module.rst b/docs/ansible.posix.rhel_facts_module.rst deleted file mode 100644 index d4c8fb6..0000000 --- a/docs/ansible.posix.rhel_facts_module.rst +++ /dev/null @@ -1,103 +0,0 @@ -.. _ansible.posix.rhel_facts_module: - - -************************ -ansible.posix.rhel_facts -************************ - -**Facts module to set or override RHEL specific facts.** - - -Version added: 1.5.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Compatibility layer for using the "package" module for rpm-ostree based systems via setting the "pkg_mgr" fact correctly. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- rpm-ostree - - - - -See Also --------- - -.. seealso:: - - :ref:`ansible.builtin.package_module` - The official documentation on the **ansible.builtin.package** module. - - -Examples --------- - -.. code-block:: yaml - - - name: Playbook to use the package module on all RHEL footprints - vars: - ansible_facts_modules: - - setup # REQUIRED to be run before all custom fact modules - - ansible.posix.rhel_facts - tasks: - - name: Ensure packages are installed - ansible.builtin.package: - name: - - htop - - ansible - state: present - - -Returned Facts --------------- -Facts returned by this module are added/updated in the ``hostvars`` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them. - -.. raw:: html - - - - - - - - - - - - -
FactReturnedDescription
-
- pkg_mgr - -
- string -
-
when needed -
System-level package manager override -
-
-
Sample:
-
{'pkg_mgr': 'ansible.posix.rhel_facts'}
-
-

- - - -Status ------- - - -Authors -~~~~~~~ - -- Adam Miller (@maxamillion) diff --git a/docs/ansible.posix.rhel_rpm_ostree_module.rst b/docs/ansible.posix.rhel_rpm_ostree_module.rst deleted file mode 100644 index b170b15..0000000 --- a/docs/ansible.posix.rhel_rpm_ostree_module.rst +++ /dev/null @@ -1,156 +0,0 @@ -.. _ansible.posix.rhel_rpm_ostree_module: - - -***************************** -ansible.posix.rhel_rpm_ostree -***************************** - -**Ensure packages exist in a RHEL for Edge rpm-ostree based system** - - -Version added: 1.5.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Compatibility layer for using the "package" module for RHEL for Edge systems utilizing the RHEL System Roles. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- rpm-ostree - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- name - -
- list - / elements=string -
-
- Default:
[]
-
-
A package name or package specifier with version, like name-1.0.
-
Comparison operators for package version are valid here >, <, >=, <=. Example - name>=1.0
-
If a previous version is specified, the task also needs to turn allow_downgrade on. See the allow_downgrade documentation for caveats with downgrading packages.
-
When using state=latest, this can be '*' which means run yum -y update.
-
You can also pass a url or a local path to a rpm file (using state=present). To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
-

aliases: pkg
-
-
- state - -
- string -
-
-
    Choices: -
  • absent
  • -
  • installed
  • -
  • latest
  • -
  • present
  • -
  • removed
  • -
-
-
Whether to install (present or installed, latest), or remove (absent or removed) a package.
-
present and installed will simply ensure that a desired package is installed.
-
latest will update the specified package if it's not of the latest available version.
-
absent and removed will remove the specified package.
-
Default is None, however in effect the default action is present unless the autoremove option is enabled for this module, then absent is inferred.
-
-
- - -Notes ------ - -.. note:: - - This module does not support installing or removing packages to/from an overlay as this is not supported by RHEL for Edge, packages needed should be defined in the osbuild Blueprint and provided to Image Builder at build time. This module exists only for ``package`` module compatibility. - - - -Examples --------- - -.. code-block:: yaml - - - name: Ensure htop and ansible are installed on rpm-ostree based RHEL - ansible.posix.rhel_rpm_ostree: - name: - - htop - - ansible - state: present - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- msg - -
- string -
-
always -
status of rpm transaction
-
-
Sample:
-
No changes made.
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Adam Miller (@maxamillion) diff --git a/docs/ansible.posix.rpm_ostree_upgrade_module.rst b/docs/ansible.posix.rpm_ostree_upgrade_module.rst deleted file mode 100644 index d683166..0000000 --- a/docs/ansible.posix.rpm_ostree_upgrade_module.rst +++ /dev/null @@ -1,175 +0,0 @@ -.. _ansible.posix.rpm_ostree_upgrade_module: - - -******************************** -ansible.posix.rpm_ostree_upgrade -******************************** - -**Manage rpm-ostree upgrade transactions** - - -Version added: 1.5.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manage an rpm-ostree upgrade transactions. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- rpm-ostree - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- allow_downgrade - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Allow for the upgrade to be a chronologically older tree.
-
-
- cache_only - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Perform the transaction using only pre-cached data, do not download.
-
-
- os - -
- string -
-
- Default:
""
-
-
The OSNAME upon which to operate.
-
-
- peer - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Force peer-to-peer connection instead of using a system message bus.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Upgrade the rpm-ostree image without options, accept all defaults - ansible.posix.rpm_ostree_upgrade: - - - name: Upgrade the rpm-ostree image allowing downgrades - ansible.posix.rpm_ostree_upgrade: - allow_downgrade: true - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- msg - -
- string -
-
always -
The command standard output
-
-
Sample:
-
No upgrade available.
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Adam Miller (@maxamillion) diff --git a/docs/ansible.posix.seboolean_module.rst b/docs/ansible.posix.seboolean_module.rst deleted file mode 100644 index 330d091..0000000 --- a/docs/ansible.posix.seboolean_module.rst +++ /dev/null @@ -1,151 +0,0 @@ -.. _ansible.posix.seboolean_module: - - -*********************** -ansible.posix.seboolean -*********************** - -**Toggles SELinux booleans** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Toggles SELinux booleans. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- libselinux-python -- libsemanage-python -- python3-libsemanage - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- ignore_selinux_state - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Useful for scenarios (chrooted environment) that you can't get the real SELinux state.
-
-
- name - -
- string - / required -
-
- -
Name of the boolean to configure.
-
-
- persistent - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Set to true if the boolean setting should survive a reboot.
-
-
- state - -
- boolean - / required -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Desired boolean value
-
-
- - -Notes ------ - -.. note:: - - Not tested on any Debian based system. - - - -Examples --------- - -.. code-block:: yaml - - - name: Set httpd_can_network_connect flag on and keep it persistent across reboots - ansible.posix.seboolean: - name: httpd_can_network_connect - state: true - persistent: true - - - - -Status ------- - - -Authors -~~~~~~~ - -- Stephen Fromm (@sfromm) diff --git a/docs/ansible.posix.selinux_module.rst b/docs/ansible.posix.selinux_module.rst deleted file mode 100644 index 20d9ef8..0000000 --- a/docs/ansible.posix.selinux_module.rst +++ /dev/null @@ -1,253 +0,0 @@ -.. _ansible.posix.selinux_module: - - -********************* -ansible.posix.selinux -********************* - -**Change policy and state of SELinux** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Configures the SELinux mode and policy. -- A reboot may be required after usage. -- Ansible will not issue this reboot but will let you know when it is required. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- libselinux-python - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- configfile - -
- string -
-
- Default:
"/etc/selinux/config"
-
-
The path to the SELinux configuration file, if non-standard.
-

aliases: conf, file
-
-
- policy - -
- string -
-
- -
The name of the SELinux policy to use (e.g. targeted) will be required if state is not disabled.
-
-
- state - -
- string - / required -
-
-
    Choices: -
  • disabled
  • -
  • enforcing
  • -
  • permissive
  • -
-
-
The SELinux mode.
-
-
- update_kernel_param - -
- boolean -
-
added in 1.4.0
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
If set to true, will update also the kernel boot parameters when disabling/enabling SELinux.
-
The grubby tool must be present on the target system for this to work.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Enable SELinux - ansible.posix.selinux: - policy: targeted - state: enforcing - - - name: Put SELinux in permissive mode, logging actions that would be blocked. - ansible.posix.selinux: - policy: targeted - state: permissive - - - name: Disable SELinux - ansible.posix.selinux: - state: disabled - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- configfile - -
- string -
-
always -
Path to SELinux configuration file.
-
-
Sample:
-
/etc/selinux/config
-
-
- msg - -
- string -
-
always -
Messages that describe changes that were made.
-
-
Sample:
-
Config SELinux state changed from 'disabled' to 'permissive'
-
-
- policy - -
- string -
-
always -
Name of the SELinux policy.
-
-
Sample:
-
targeted
-
-
- reboot_required - -
- boolean -
-
always -
Whether or not an reboot is required for the changes to take effect.
-
-
Sample:
-
True
-
-
- state - -
- string -
-
always -
SELinux mode.
-
-
Sample:
-
enforcing
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- Derek Carter (@goozbach) diff --git a/docs/ansible.posix.synchronize_module.rst b/docs/ansible.posix.synchronize_module.rst deleted file mode 100644 index 7cb3059..0000000 --- a/docs/ansible.posix.synchronize_module.rst +++ /dev/null @@ -1,744 +0,0 @@ -.. _ansible.posix.synchronize_module: - - -************************* -ansible.posix.synchronize -************************* - -**A wrapper around rsync to make common tasks in your playbooks quick and easy** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- ``synchronize`` is a wrapper around rsync to make common tasks in your playbooks quick and easy. -- It is run and originates on the local host where Ansible is being run. -- Of course, you could just use the ``command`` action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. -- This module is not intended to provide access to the full power of rsync, but does make the most common invocations easier to implement. You `still` may need to call rsync directly via ``command`` or ``shell`` depending on your use case. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- archive - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.
-
-
- checksum - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will not disable it.
-
-
- compress - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Compress file data during the transfer.
-
In most cases, leave this enabled unless it causes problems.
-
-
- copy_links - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.
-
-
- delay_updates - -
- boolean -
-
added in 1.3.0
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
This option puts the temporary file from each updated file into a holding directory until the end of the transfer, at which time all the files are renamed into place in rapid succession.
-
-
- delete - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Delete files in dest that do not exist (after transfer, not before) in the src path.
-
This option requires recursive=true.
-
This option ignores excluded files and behaves like the rsync opt --delete-after.
-
-
- dest - -
- string - / required -
-
- -
Path on the destination host that will be synchronized from the source.
-
The path can be absolute or relative.
-
-
- dest_port - -
- integer -
-
- -
Port number for ssh on the destination host.
-
Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.
-
This parameter defaults to the value of ansible_port, the remote_port config setting or the value from ssh client configuration if none of the former have been set.
-
-
- dirs - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Transfer directories without recursing.
-
-
- existing_only - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Skip creating new files on receiver.
-
-
- group - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Preserve group.
-
This parameter defaults to the value of the archive option.
-
-
- link_dest - -
- list - / elements=string -
-
- Default:
null
-
-
Add a destination to hard link against during the rsync.
-
-
- links - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Copy symlinks as symlinks.
-
This parameter defaults to the value of the archive option.
-
-
- mode - -
- string -
-
-
    Choices: -
  • pull
  • -
  • push ←
  • -
-
-
Specify the direction of the synchronization.
-
In push mode the localhost or delegate is the source.
-
In pull mode the remote host in context is the source.
-
-
- owner - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Preserve owner (super user only).
-
This parameter defaults to the value of the archive option.
-
-
- partial - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
-
-
- perms - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Preserve permissions.
-
This parameter defaults to the value of the archive option.
-
-
- private_key - -
- path -
-
- -
Specify the private key to use for SSH-based rsync connections (e.g. ~/.ssh/id_rsa).
-
-
- recursive - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Recurse into directories.
-
This parameter defaults to the value of the archive option.
-
-
- rsync_opts - -
- list - / elements=string -
-
- Default:
null
-
-
Specify additional rsync options by passing in an array.
-
Note that an empty string in rsync_opts will end up transfer the current working directory.
-
-
- rsync_path - -
- string -
-
- -
Specify the rsync command to run on the remote host. See --rsync-path on the rsync man page.
-
To specify the rsync command to run on the local host, you need to set this your task var ansible_rsync_path.
-
-
- rsync_timeout - -
- integer -
-
- Default:
0
-
-
Specify a --timeout for the rsync command in seconds.
-
-
- set_remote_user - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Put user@ for the remote paths.
-
If you have a custom ssh config to define the remote user for a host that does not match the inventory user, you should set this parameter to false.
-
-
- src - -
- string - / required -
-
- -
Path on the source host that will be synchronized to the destination.
-
The path can be absolute or relative.
-
-
- ssh_connection_multiplexing - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections. This is accomplished by setting the SSH ControlSocket to none.
-
Set this option to true to allow multiplexing and reduce SSH connection overhead.
-
Note that simply setting this option to true is not enough; You must also configure SSH connection multiplexing in your SSH client config by setting values for ControlMaster, ControlPersist and ControlPath.
-
-
- times - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Preserve modification times.
-
This parameter defaults to the value of the archive option.
-
-
- use_ssh_args - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
In Ansible 2.10 and lower, it uses the ssh_args specified in ansible.cfg.
-
In Ansible 2.11 and onwards, when set to true, it uses all SSH connection configurations like ansible_ssh_args, ansible_ssh_common_args, and ansible_ssh_extra_args.
-
-
- verify_host - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Verify destination host key.
-
-
- - -Notes ------ - -.. note:: - - rsync must be installed on both the local and remote host. - - For the ``synchronize`` module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host `synchronize is connecting to`. - - The "local host" can be changed to a different host by using `delegate_to`. This enables copying between two remote hosts or entirely on one remote machine. - - The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host (or the remote_user for a delegate_to host when delegate_to is used). - - - The user and permissions for the synchronize `dest` are those of the `remote_user` on the destination host or the `become_user` if `become=yes` is active. - - In Ansible 2.0 a bug in the synchronize module made become occur on the "local host". This was fixed in Ansible 2.0.1. - - Currently, synchronize is limited to elevating permissions via passwordless sudo. This is because rsync itself is connecting to the remote machine and rsync doesn't give us a way to pass sudo credentials in. - - Currently there are only a few connection types which support synchronize (ssh, paramiko, local, and docker) because a sync strategy has been determined for those connection types. Note that the connection for these must not need a password as rsync itself is making the connection and rsync does not provide us a way to pass a password to the connection. - - Expect that dest=~/x will be ~/x even if using sudo. - - Inspect the verbose output to validate the destination user/host/path are what was expected. - - To exclude files and directories from being synchronized, you may add ``.rsync-filter`` files to the source directory. - - rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path. - - The ``synchronize`` module enables `--delay-updates` by default to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should disable this option. - - link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented. - - -See Also --------- - -.. seealso:: - - :ref:`ansible.builtin.copy_module` - The official documentation on the **ansible.builtin.copy** module. - :ref:`community.windows.win_robocopy_module` - The official documentation on the **community.windows.win_robocopy** module. - - -Examples --------- - -.. code-block:: yaml - - - name: Synchronization of src on the control machine to dest on the remote hosts - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - - - name: Synchronization using rsync protocol (push) - ansible.posix.synchronize: - src: some/relative/path/ - dest: rsync://somehost.com/path/ - - - name: Synchronization using rsync protocol (pull) - ansible.posix.synchronize: - mode: pull - src: rsync://somehost.com/path/ - dest: /some/absolute/path/ - - - name: Synchronization using rsync protocol on delegate host (push) - ansible.posix.synchronize: - src: /some/absolute/path/ - dest: rsync://somehost.com/path/ - delegate_to: delegate.host - - - name: Synchronization using rsync protocol on delegate host (pull) - ansible.posix.synchronize: - mode: pull - src: rsync://somehost.com/path/ - dest: /some/absolute/path/ - delegate_to: delegate.host - - - name: Synchronization without any --archive options enabled - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - archive: false - - - name: Synchronization with --archive options enabled except for --recursive - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - recursive: false - - - name: Synchronization with --archive options enabled except for --times, with --checksum option enabled - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - checksum: true - times: false - - - name: Synchronization without --archive options enabled except use --links - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - archive: false - links: true - - - name: Synchronization of two paths both on the control machine - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - delegate_to: localhost - - - name: Synchronization of src on the inventory host to the dest on the localhost in pull mode - ansible.posix.synchronize: - mode: pull - src: some/relative/path - dest: /some/absolute/path - - - name: Synchronization of src on delegate host to dest on the current inventory host. - ansible.posix.synchronize: - src: /first/absolute/path - dest: /second/absolute/path - delegate_to: delegate.host - - - name: Synchronize two directories on one remote host. - ansible.posix.synchronize: - src: /first/absolute/path - dest: /second/absolute/path - delegate_to: "{{ inventory_hostname }}" - - - name: Synchronize and delete files in dest on the remote host that are not found in src of localhost. - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - delete: true - recursive: true - - # This specific command is granted su privileges on the destination - - name: Synchronize using an alternate rsync command - ansible.posix.synchronize: - src: some/relative/path - dest: /some/absolute/path - rsync_path: su -c rsync - - # Example .rsync-filter file in the source directory - # - var # exclude any path whose last part is 'var' - # - /var # exclude any path starting with 'var' starting at the source directory - # + /var/conf # include /var/conf even though it was previously excluded - - - name: Synchronize passing in extra rsync options - ansible.posix.synchronize: - src: /tmp/helloworld - dest: /var/www/helloworld - rsync_opts: - - "--no-motd" - - "--exclude=.git" - - # Hardlink files if they didn't change - - name: Use hardlinks when synchronizing filesystems - ansible.posix.synchronize: - src: /tmp/path_a/foo.txt - dest: /tmp/path_b/foo.txt - link_dest: /tmp/path_a/ - - # Specify the rsync binary to use on remote host and on local host - - hosts: groupofhosts - vars: - ansible_rsync_path: /usr/gnu/bin/rsync - - tasks: - - name: copy /tmp/localpath/ to remote location /tmp/remotepath - ansible.posix.synchronize: - src: /tmp/localpath/ - dest: /tmp/remotepath - rsync_path: /usr/gnu/bin/rsync - - - - -Status ------- - - -Authors -~~~~~~~ - -- Timothy Appnel (@tima) diff --git a/docs/ansible.posix.sysctl_module.rst b/docs/ansible.posix.sysctl_module.rst deleted file mode 100644 index 1a3b111..0000000 --- a/docs/ansible.posix.sysctl_module.rst +++ /dev/null @@ -1,215 +0,0 @@ -.. _ansible.posix.sysctl_module: - - -******************** -ansible.posix.sysctl -******************** - -**Manage entries in sysctl.conf.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- This module manipulates sysctl entries and optionally performs a ``/sbin/sysctl -p`` after changing them. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- ignoreerrors - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Use this option to ignore errors about unknown keys.
-
-
- name - -
- string - / required -
-
- -
The dot-separated path (also known as key) specifying the sysctl variable.
-

aliases: key
-
-
- reload - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
If true, performs a /sbin/sysctl -p if the sysctl_file is updated. If false, does not reload sysctl even if the sysctl_file is updated.
-
-
- state - -
- string -
-
-
    Choices: -
  • present ←
  • -
  • absent
  • -
-
-
Whether the entry should be present or absent in the sysctl file.
-
-
- sysctl_file - -
- path -
-
- Default:
"/etc/sysctl.conf"
-
-
Specifies the absolute path to sysctl.conf, if not /etc/sysctl.conf.
-
-
- sysctl_set - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Verify token value with the sysctl command and set with -w if necessary.
-
-
- value - -
- string -
-
- -
Desired value of the sysctl key.
-

aliases: val
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - # Set vm.swappiness to 5 in /etc/sysctl.conf - - ansible.posix.sysctl: - name: vm.swappiness - value: '5' - state: present - - # Remove kernel.panic entry from /etc/sysctl.conf - - ansible.posix.sysctl: - name: kernel.panic - state: absent - sysctl_file: /etc/sysctl.conf - - # Set kernel.panic to 3 in /tmp/test_sysctl.conf - - ansible.posix.sysctl: - name: kernel.panic - value: '3' - sysctl_file: /tmp/test_sysctl.conf - reload: false - - # Set ip forwarding on in /proc and verify token value with the sysctl command - - ansible.posix.sysctl: - name: net.ipv4.ip_forward - value: '1' - sysctl_set: true - - # Set ip forwarding on in /proc and in the sysctl file and reload if necessary - - ansible.posix.sysctl: - name: net.ipv4.ip_forward - value: '1' - sysctl_set: true - state: present - reload: true - - - - -Status ------- - - -Authors -~~~~~~~ - -- David CHANIAL (@davixx) From 0341c9420f0959fcc4a6c851e32957b73f9aeafd Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 12 Jun 2024 08:35:57 +0900 Subject: [PATCH 05/42] Replace AZP default image with 6.0.0 - See https://github.com/ansible-collections/news-for-maintainers/issues/71 Signed-off-by: Hideki Saito --- .azure-pipelines/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index a81a888..0169be1 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -37,7 +37,7 @@ variables: resources: containers: - container: default - image: quay.io/ansible/azure-pipelines-test-container:main + image: quay.io/ansible/azure-pipelines-test-container:6.0.0 pool: Standard From 0c9ab06a558e103ee6d53eb1e902b4cf6431c94b Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Thu, 6 Jun 2024 22:56:16 +1200 Subject: [PATCH 06/42] review modules docs --- plugins/modules/acl.py | 18 ++++---- plugins/modules/at.py | 2 +- plugins/modules/authorized_key.py | 20 ++++----- plugins/modules/firewalld.py | 28 ++++++------ plugins/modules/firewalld_info.py | 2 +- plugins/modules/mount.py | 72 +++++++++++++++--------------- plugins/modules/patch.py | 16 +++---- plugins/modules/rhel_facts.py | 2 +- plugins/modules/rhel_rpm_ostree.py | 20 ++++----- plugins/modules/seboolean.py | 4 +- plugins/modules/selinux.py | 4 +- plugins/modules/synchronize.py | 59 ++++++++++++------------ plugins/modules/sysctl.py | 8 ++-- 13 files changed, 128 insertions(+), 127 deletions(-) diff --git a/plugins/modules/acl.py b/plugins/modules/acl.py index 1fde8eb..acde18b 100644 --- a/plugins/modules/acl.py +++ b/plugins/modules/acl.py @@ -25,7 +25,7 @@ options: state: description: - Define whether the ACL should be present or not. - - The C(query) state gets the current ACL without changing it, for use in C(register) operations. + - The V(query) state gets the current ACL without changing it, for use in C(register) operations. choices: [ absent, present, query ] default: query type: str @@ -36,8 +36,8 @@ options: default: true default: description: - - If the target is a directory, setting this to C(true) will make it the default ACL for entities created inside the directory. - - Setting C(default) to C(true) causes an error if the path is a file. + - If O(path) is a directory, setting this to V(true) will make it the default ACL for entities created inside the directory. + - Setting O(default=true) causes an error if O(path) is a file. type: bool default: false entity: @@ -53,7 +53,7 @@ options: permissions: description: - The permissions to apply/remove can be any combination of C(r), C(w), C(x) - - (read, write and execute respectively), and C(X) (execute permission if the file is a directory or already has execute permission for some user) + (read, write and execute respectively), and C(X) (execute permission if the file is a directory or already has execute permission for some user) type: str entry: description: @@ -67,8 +67,8 @@ options: recursive: description: - Recursively sets the specified ACL. - - Incompatible with C(state=query). - - Alias C(recurse) added in version 1.3.0. + - Incompatible with O(state=query). + - Alias O(recurse) added in version 1.3.0. type: bool default: false aliases: [ recurse ] @@ -81,7 +81,7 @@ options: description: - Select if and when to recalculate the effective right masks of the files. - See C(setfacl) documentation for more info. - - Incompatible with C(state=query). + - Incompatible with O(state=query). choices: [ default, mask, no_mask ] default: default type: str @@ -89,9 +89,9 @@ author: - Brian Coca (@bcoca) - Jérémie Astori (@astorije) notes: -- The C(acl) module requires that ACLs are enabled on the target filesystem and that the C(setfacl) and C(getfacl) binaries are installed. +- The M(ansible.posix.acl) module requires that ACLs are enabled on the target filesystem and that the C(setfacl) and C(getfacl) binaries are installed. - As of Ansible 2.0, this module only supports Linux distributions. -- As of Ansible 2.3, the I(name) option has been changed to I(path) as default, but I(name) still works as well. +- As of Ansible 2.3, the O(name) option has been changed to O(path) as default, but O(name) still works as well. ''' EXAMPLES = r''' diff --git a/plugins/modules/at.py b/plugins/modules/at.py index 3db953e..fefe6f2 100644 --- a/plugins/modules/at.py +++ b/plugins/modules/at.py @@ -36,7 +36,7 @@ options: choices: [ minutes, hours, days, weeks ] state: description: - - The state dictates if the command or script file should be evaluated as present(added) or absent(deleted). + - The state dictates if the command or script file should be evaluated as V(present)(added) or V(absent)(deleted). type: str choices: [ absent, present ] default: present diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 26b5b0a..9fbc610 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -29,17 +29,17 @@ options: path: description: - Alternative path to the authorized_keys file. - - The default value is the C(.ssh/authorized_keys) of the home of the user specified in the O(user) parameter. - - Most of the time, it's not necessary to set this key. + - The default value is the V(.ssh/authorized_keys) of the home of the user specified in the O(user) parameter. + - Most of the time, it is not necessary to set this key. - Use the path to your target authorized_keys if you need to explicitly point on it. type: path manage_dir: description: - Whether this module should manage the directory of the authorized key file. - - If set to C(true), the module will create the directory, as well as set the owner and permissions + - If set to V(true), the module will create the directory, as well as set the owner and permissions of an existing directory. - - Be sure to set C(manage_dir=false) if you are using an alternate directory for authorized_keys, - as set with C(path), since you could lock yourself out of SSH access. + - Be sure to set O(manage_dir=false) if you are using an alternate directory for authorized_keys, + as set with O(path), since you could lock yourself out of SSH access. - See the example below. type: bool default: true @@ -56,17 +56,17 @@ options: exclusive: description: - Whether to remove all other non-specified keys from the authorized_keys file. - - Multiple keys can be specified in a single C(key) string value by separating them by newlines. + - Multiple keys can be specified in a single O(key) string value by separating them by newlines. - This option is not loop aware, so if you use C(with_) , it will be exclusive per iteration of the loop. - - If you want multiple keys in the file you need to pass them all to C(key) in a single batch as mentioned above. + - If you want multiple keys in the file you need to pass them all to O(key) in a single batch as mentioned above. type: bool default: false validate_certs: description: - This only applies if using a https url as the source of the keys. - - If set to C(false), the SSL certificates will not be validated. - - This should only set to C(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. - - Prior to 2.1 the code worked as if this was set to C(true). + - If set to V(false), the SSL certificates will not be validated. + - This should only set to V(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. + - Prior to 2.1 the code worked as if this was set to V(true). type: bool default: true comment: diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index 146990f..dc930ca 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -17,7 +17,7 @@ options: service: description: - Name of a service to add/remove to/from firewalld. - - The service must be listed in output of firewall-cmd --get-services. + - The service must be listed in output of C(firewall-cmd --get-services). type: str protocol: description: @@ -38,22 +38,22 @@ options: type: str required: true description: - - Source port to forward from + - Source port to forward from. proto: type: str required: true description: - - protocol to forward + - protocol to forward. choices: [udp, tcp] toport: type: str required: true description: - - destination port + - destination port. toaddr: type: str description: - - Optional address to forward to + - Optional address to forward to. rich_rule: description: - Rich rule to add/remove to/from firewalld. @@ -78,28 +78,28 @@ options: zone: description: - The firewalld zone to add/remove to/from. - - Note that the default zone can be configured per system but C(public) is default from upstream. + - Note that the default zone can be configured per system but V(public) is default from upstream. - Available choices can be extended based on per-system configs, listed here are "out of the box" defaults. - - Possible values include C(block), C(dmz), C(drop), C(external), C(home), C(internal), C(public), C(trusted), C(work). + - Possible values include V(block), V(dmz), V(drop), V(external), V(home), V(internal), V(public), V(trusted), V(work). type: str permanent: description: - Whether to apply this change to the permanent firewalld configuration. - As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9). - - Note that if this is C(false), I(immediate) defaults to C(true). + - Note that if this is V(false), O(immediate=true). type: bool default: false immediate: description: - Whether to apply this change to the runtime firewalld configuration. - - Defaults to C(true) if I(permanent=false). + - Defaults to V(true) if O(permanent=false). type: bool default: false state: description: - Enable or disable a setting. - - 'For ports: Should this port accept (enabled) or reject (disabled) connections.' - - The states C(present) and C(absent) can only be used in zone level operations (i.e. when no other parameters but zone and state are set). + - 'For ports: Should this port accept (V(enabled)) or reject (V(disabled)) connections.' + - The states V(present) and V(absent) can only be used in zone level operations (i.e. when no other parameters but zone and state are set). type: str required: true choices: [ absent, disabled, enabled, present ] @@ -114,13 +114,13 @@ options: type: str offline: description: - - Ignores I(immediate) if I(permanent=true) and firewalld is not running. + - Ignores O(immediate) if O(permanent=true) and firewalld is not running. type: bool default: false target: description: - - firewalld Zone target - - If state is set to C(absent), this will reset the target to default + - firewalld Zone target. + - If O(state=absent), this will reset the target to default. choices: [ default, ACCEPT, DROP, "%%REJECT%%" ] type: str version_added: 1.2.0 diff --git a/plugins/modules/firewalld_info.py b/plugins/modules/firewalld_info.py index c83437d..c34a362 100644 --- a/plugins/modules/firewalld_info.py +++ b/plugins/modules/firewalld_info.py @@ -21,7 +21,7 @@ options: zones: description: - Gather information about specific zones. - - If only works if C(active_zones) is set to C(false). + - If only works if O(active_zones=false). required: false type: list elements: str diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 318844b..4fdd826 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -24,20 +24,20 @@ options: path: description: - Path to the mount point (e.g. C(/mnt/files)). - - Before Ansible 2.3 this option was only usable as I(dest), I(destfile) and I(name). + - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile) and O(name). type: path required: true aliases: [ name ] src: description: - Device (or NFS volume, or something else) to be mounted on I(path). - - Required when I(state) set to C(present), C(mounted) or C(ephemeral). - - Ignored when I(state) set to C(absent) or C(unmounted). + - Required when O(state) set to V(present), V(mounted) or V(ephemeral). + - Ignored when O(state) set to V(absent) or V(unmounted). type: path fstype: description: - Filesystem type. - - Required when I(state) is C(present), C(mounted) or C(ephemeral). + - Required when O(state) is V(present), V(mounted) or V(ephemeral). type: str opts: description: @@ -46,53 +46,53 @@ options: dump: description: - Dump (see fstab(5)). - - Note that if set to C(null) and I(state) set to C(present), + - Note that if set to C(null) and O(state=present), it will cease to work and duplicate entries will be made with subsequent runs. - - Has no effect on Solaris systems or when used with C(ephemeral). + - Has no effect on Solaris systems or when used with O(state=ephemeral). type: str default: '0' passno: description: - Passno (see fstab(5)). - - Note that if set to C(null) and I(state) set to C(present), + - Note that if set to C(null) and O(state=present), it will cease to work and duplicate entries will be made with subsequent runs. - - Deprecated on Solaris systems. Has no effect when used with C(ephemeral). + - Deprecated on Solaris systems. Has no effect when used with O(state=ephemeral). type: str default: '0' state: description: - - If C(mounted), the device will be actively mounted and appropriately + - If V(mounted), the device will be actively mounted and appropriately configured in I(fstab). If the mount point is not present, the mount point will be created. - - If C(unmounted), the device will be unmounted without changing I(fstab). - - C(present) only specifies that the device is to be configured in + - If V(unmounted), the device will be unmounted without changing I(fstab). + - V(present) only specifies that the device is to be configured in I(fstab) and does not trigger or require a mount. - - C(ephemeral) only specifies that the device is to be mounted, without changing + - V(ephemeral) only specifies that the device is to be mounted, without changing I(fstab). If it is already mounted, a remount will be triggered. - This will always return changed=True. If the mount point I(path) - has already a device mounted on, and its source is different than I(src), + This will always return RV(ignore:changed=True). If the mount point O(path) + has already a device mounted on, and its source is different than O(src), the module will fail to avoid unexpected unmount or mount point override. If the mount point is not present, the mount point will be created. The I(fstab) is completely ignored. This option is added in version 1.5.0. - - C(absent) specifies that the mount point entry I(path) will be removed + - V(absent) specifies that the mount point entry O(path) will be removed from I(fstab) and will also unmount the mounted device and remove the - mount point. A mounted device will be unmounted regardless of I(src) or its - real source. C(absent) does not unmount recursively, and the module will + mount point. A mounted device will be unmounted regardless of O(src) or its + real source. V(absent) does not unmount recursively, and the module will fail if multiple devices are mounted on the same mount point. Using - C(absent) with a mount point that is not registered in the I(fstab) has - no effect. Use C(unmounted) instead.. - - C(remounted) specifies that the device will be remounted for when you + V(absent) 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 changed=true. If I(opts) is set, the options will be + always return RV(ignore:changed=true). If O(opts) is set, the options will be applied to the remount, but will not change I(fstab). Additionally, - if I(opts) is set, and the remount command fails, the module will - error to prevent unexpected mount changes. Try using C(mounted) - instead to work around this issue. C(remounted) expects the mount point + if O(opts) is set, and the remount command fails, the module will + error to prevent unexpected mount changes. Try using V(mounted) + instead to work around this issue. V(remounted) expects the mount point to be present in the I(fstab). To remount a mount point not registered - in I(fstab), use C(ephemeral) instead, especially with BSD nodes. - - C(absent_from_fstab) specifies that the device mount's entry will be + in I(fstab), use V(ephemeral) instead, especially with BSD nodes. + - V(absent_from_fstab) specifies that the device mount's entry will be removed from I(fstab). This option does not unmount it or delete the mountpoint. type: str @@ -105,20 +105,20 @@ options: - This might be useful if you need to configure mountpoints in a chroot environment. - OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem. - - This parameter defaults to /etc/fstab or /etc/vfstab on Solaris. - - This parameter is ignored when I(state) is set to C(ephemeral). + - This parameter defaults to C(/etc/fstab) or C(/etc/vfstab) on Solaris. + - This parameter is ignored when O(state=ephemeral). type: str boot: description: - Determines if the filesystem should be mounted on boot. - Only applies to Solaris and Linux systems. - For Solaris systems, C(true) will set C(yes) as the value of mount at boot - in I(/etc/vfstab). + in C(/etc/vfstab). - For Linux, FreeBSD, NetBSD and OpenBSD systems, C(false) will add C(noauto) - to mount options in I(/etc/fstab). - - To avoid mount option conflicts, if C(noauto) specified in C(opts), - mount module will ignore C(boot). - - This parameter is ignored when I(state) is set to C(ephemeral). + to mount options in C(/etc/fstab). + - To avoid mount option conflicts, if C(noauto) specified in O(opts), + mount module will ignore O(boot). + - This parameter is ignored when O(state=ephemeral). type: bool default: true backup: @@ -128,9 +128,9 @@ options: type: bool default: false notes: - - As of Ansible 2.3, the I(name) option has been changed to I(path) as - default, but I(name) still works as well. - - Using C(remounted) with I(opts) set may create unexpected results based on + - As of Ansible 2.3, the O(name) option has been changed to O(path) as + default, but O(name) still works as well. + - Using O(state=remounted) with O(opts) set may create unexpected results based on the existing options already defined on mount, so care should be taken to ensure that conflicting options are not present before hand. ''' diff --git a/plugins/modules/patch.py b/plugins/modules/patch.py index ecedbf6..39744a7 100644 --- a/plugins/modules/patch.py +++ b/plugins/modules/patch.py @@ -24,7 +24,7 @@ options: basedir: description: - Path of a base directory in which the patch file will be applied. - - May be omitted when C(dest) option is specified, otherwise required. + - May be omitted when O(dest) option is specified, otherwise required. type: path dest: description: @@ -37,7 +37,7 @@ options: src: description: - Path of the patch file as accepted by the GNU patch tool. If - C(remote_src) is C(false), the patch source file is looked up from the + O(remote_src=false), the patch source file is looked up from the module's I(files) directory. type: path required: true @@ -50,8 +50,8 @@ options: default: present remote_src: description: - - If C(false), it will search for src at originating/controller machine, if C(true) it will - go to the remote/target machine for the C(src). + - If V(false), it will search for src at originating/controller machine, + - If C(true), it will go to the remote/target machine for the O(src). type: bool default: false strip: @@ -68,15 +68,15 @@ options: default: false binary: description: - - Setting to C(true) will disable patch's heuristic for transforming CRLF + - Setting to V(true) will disable patch's heuristic for transforming CRLF line endings into LF. - - Line endings of src and dest must match. - - If set to C(false), C(patch) will replace CRLF in C(src) files on POSIX. + - Line endings of O(src) and O(dest) must match. + - If set to V(false), C(patch) will replace CRLF in O(src) files on POSIX. type: bool default: false ignore_whitespace: description: - - Setting to C(true) will ignore white space changes between patch and input. + - Setting to V(true) will ignore white space changes between patch and input. type: bool default: false notes: diff --git a/plugins/modules/rhel_facts.py b/plugins/modules/rhel_facts.py index a30622a..d0c5927 100644 --- a/plugins/modules/rhel_facts.py +++ b/plugins/modules/rhel_facts.py @@ -13,7 +13,7 @@ module: rhel_facts version_added: 1.5.0 short_description: Facts module to set or override RHEL specific facts. description: - - Compatibility layer for using the "package" module for rpm-ostree based systems via setting the "pkg_mgr" fact correctly. + - Compatibility layer for using the M(ansible.builtin.package) module for rpm-ostree based systems via setting the C(pkg_mgr) fact correctly. author: - Adam Miller (@maxamillion) requirements: diff --git a/plugins/modules/rhel_rpm_ostree.py b/plugins/modules/rhel_rpm_ostree.py index 0976e02..0aafb54 100644 --- a/plugins/modules/rhel_rpm_ostree.py +++ b/plugins/modules/rhel_rpm_ostree.py @@ -25,12 +25,12 @@ requirements: options: name: description: - - A package name or package specifier with version, like C(name-1.0). - - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0) + - A package name or package specifier with version, like V(name-1.0). + - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0). - If a previous version is specified, the task also needs to turn C(allow_downgrade) on. See the C(allow_downgrade) documentation for caveats with downgrading packages. - - When using state=latest, this can be C('*') which means run C(yum -y update). - - You can also pass a url or a local path to a rpm file (using state=present). + - When using O(state=latest), this can be V('*') which means run C(yum -y update). + - You can also pass a url or a local path to a rpm file (using O(state=present)). To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages. aliases: [ pkg ] type: list @@ -38,12 +38,12 @@ options: default: [] state: description: - - Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package. - - C(present) and C(installed) will simply ensure that a desired package is installed. - - C(latest) will update the specified package if it's not of the latest available version. - - C(absent) and C(removed) will remove the specified package. - - Default is C(None), however in effect the default action is C(present) unless the C(autoremove) option is - enabled for this module, then C(absent) is inferred. + - Whether to install (V(present) or V(installed), V(latest)), or remove (V(absent) or V(removed)) a package. + - V(present) and V(installed) will simply ensure that a desired package is installed. + - V(latest) will update the specified package if it's not of the latest available version. + - V(absent) and V(removed) will remove the specified package. + - Default is C(null), however in effect the default action is V(present) unless the C(autoremove) option is + enabled for this module, then V(absent) is inferred. type: str choices: [ absent, installed, latest, present, removed ] notes: diff --git a/plugins/modules/seboolean.py b/plugins/modules/seboolean.py index 1e73aef..8580c62 100644 --- a/plugins/modules/seboolean.py +++ b/plugins/modules/seboolean.py @@ -22,12 +22,12 @@ options: type: str persistent: description: - - Set to C(true) if the boolean setting should survive a reboot. + - Set to V(true) if the boolean setting should survive a reboot. type: bool default: false state: description: - - Desired boolean value + - Desired boolean value. type: bool required: true ignore_selinux_state: diff --git a/plugins/modules/selinux.py b/plugins/modules/selinux.py index 0609462..41c51d0 100644 --- a/plugins/modules/selinux.py +++ b/plugins/modules/selinux.py @@ -20,7 +20,7 @@ version_added: "1.0.0" options: policy: description: - - The name of the SELinux policy to use (e.g. C(targeted)) will be required if I(state) is not C(disabled). + - The name of the SELinux policy to use (e.g. C(targeted)) will be required unless O(state=disabled). type: str state: description: @@ -30,7 +30,7 @@ options: type: str update_kernel_param: description: - - If set to I(true), will update also the kernel boot parameters when disabling/enabling SELinux. + - If set to V(true), will update also the kernel boot parameters when disabling/enabling SELinux. - The C(grubby) tool must be present on the target system for this to work. default: false type: bool diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 3d8d0fe..3c3ba25 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -14,12 +14,13 @@ DOCUMENTATION = r''' module: synchronize short_description: A wrapper around rsync to make common tasks in your playbooks quick and easy description: - - C(synchronize) is a wrapper around rsync to make common tasks in your playbooks quick and easy. + - M(ansible.posix.synchronize) is a wrapper around C(rsync) to make common tasks in your playbooks quick and easy. - It is run and originates on the local host where Ansible is being run. - - Of course, you could just use the C(command) action to call rsync yourself, but you also have to add a fair number of + - Of course, you could just use the M(ansible.builtin.command) action to call C(rsync) yourself, but you also have to add a fair number of boilerplate options and host facts. - - This module is not intended to provide access to the full power of rsync, but does make the most common - invocations easier to implement. You `still` may need to call rsync directly via C(command) or C(shell) depending on your use case. + - This module is not intended to provide access to the full power of C(rsync), but does make the most common + invocations easier to implement. + You I(still) may need to call C(rsync) directly via M(ansible.builtin.command) or M(ansible.builtin.shell) depending on your use case. version_added: "1.0.0" options: src: @@ -37,27 +38,27 @@ options: dest_port: description: - Port number for ssh on the destination host. - - Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value. + - Prior to Ansible 2.0, the C(ansible_ssh_port) inventory var took precedence over this value. - This parameter defaults to the value of C(ansible_port), the C(remote_port) config setting or the value from ssh client configuration if none of the former have been set. type: int mode: description: - Specify the direction of the synchronization. - - In push mode the localhost or delegate is the source. - - In pull mode the remote host in context is the source. + - In V(push) mode the localhost or delegate is the source. + - In V(pull) mode the remote host in context is the source. type: str choices: [ pull, push ] default: push archive: description: - - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D. + - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and C(-D). type: bool default: true checksum: description: - - Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will - not disable it. + - Skip based on checksum, rather than mod-time & size; Note that that O(archive) option is still enabled by default - + the O(checksum) option will not disable it. type: bool default: false compress: @@ -73,8 +74,8 @@ options: default: false delete: description: - - Delete files in I(dest) that do not exist (after transfer, not before) in the I(src) path. - - This option requires I(recursive=true). + - Delete files in O(dest) that do not exist (after transfer, not before) in the O(src) path. + - This option requires O(recursive=true). - This option ignores excluded files and behaves like the rsync opt C(--delete-after). type: bool default: false @@ -130,17 +131,17 @@ options: default: 0 set_remote_user: description: - - Put user@ for the remote paths. + - Put C(user@) for the remote paths. - If you have a custom ssh config to define the remote user for a host - that does not match the inventory user, you should set this parameter to C(false). + that does not match the inventory user, you should set this parameter to V(false). type: bool default: true ssh_connection_multiplexing: description: - SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections. This is accomplished by setting the SSH C(ControlSocket) to C(none). - - Set this option to C(true) to allow multiplexing and reduce SSH connection overhead. - - Note that simply setting this option to C(true) is not enough; + - Set this option to V(true) to allow multiplexing and reduce SSH connection overhead. + - Note that simply setting this option to V(true) is not enough; You must also configure SSH connection multiplexing in your SSH client config by setting values for C(ControlMaster), C(ControlPersist) and C(ControlPath). type: bool @@ -182,7 +183,7 @@ options: use_ssh_args: description: - In Ansible 2.10 and lower, it uses the ssh_args specified in C(ansible.cfg). - - In Ansible 2.11 and onwards, when set to C(true), it uses all SSH connection configurations like + - In Ansible 2.11 and onwards, when set to V(true), it uses all SSH connection configurations like C(ansible_ssh_args), C(ansible_ssh_common_args), and C(ansible_ssh_extra_args). type: bool default: false @@ -200,31 +201,31 @@ options: type: bool default: false _ssh_args: - description: Internal use only. See C(use_ssh_args) for ssh arg settings. + description: Internal use only. See O(use_ssh_args) for ssh arg settings. type: str required: false notes: - - rsync must be installed on both the local and remote host. - - For the C(synchronize) module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host - `synchronize is connecting to`. - - The "local host" can be changed to a different host by using `delegate_to`. This enables copying between two remote hosts or entirely on one - remote machine. + - C(rsync) must be installed on both the local and remote host. + - For the M(ansible.posix.synchronize) module, the "local host" is the host `the synchronize task originates on`, + and the "destination host" is the host `synchronize is connecting to`. + - The "local host" can be changed to a different host by using C(delegate_to). + This enables copying between two remote hosts or entirely on one remote machine. - > - The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host (or the remote_user for a - delegate_to host when delegate_to is used). + The user and permissions for the synchronize O(src) are those of the user running the Ansible task on the local host (or the remote_user for a + C(delegate_to) host when C(delegate_to) is used). - The user and permissions for the synchronize `dest` are those of the `remote_user` on the destination host or the `become_user` if `become=yes` is active. - In Ansible 2.0 a bug in the synchronize module made become occur on the "local host". This was fixed in Ansible 2.0.1. - - Currently, synchronize is limited to elevating permissions via passwordless sudo. This is because rsync itself is connecting to the remote machine - and rsync doesn't give us a way to pass sudo credentials in. + - Currently, M(ansible.posix.synchronize) is limited to elevating permissions via passwordless sudo. + This is because rsync itself is connecting to the remote machine and rsync doesn't give us a way to pass sudo credentials in. - Currently there are only a few connection types which support synchronize (ssh, paramiko, local, and docker) because a sync strategy has been determined for those connection types. Note that the connection for these must not need a password as rsync itself is making the connection and rsync does not provide us a way to pass a password to the connection. - - Expect that dest=~/x will be ~/x even if using sudo. + - Expect that O(dest=~/x) will be V(~/x) even if using sudo. - Inspect the verbose output to validate the destination user/host/path are what was expected. - To exclude files and directories from being synchronized, you may add C(.rsync-filter) files to the source directory. - rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path. - - The C(synchronize) module enables `--delay-updates` by default to avoid leaving a destination in a broken in-between state if the underlying rsync process + - The C(synchronize) module enables C(--delay-updates) by default to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should disable this option. - link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented. diff --git a/plugins/modules/sysctl.py b/plugins/modules/sysctl.py index 7914e9d..3d1242f 100644 --- a/plugins/modules/sysctl.py +++ b/plugins/modules/sysctl.py @@ -19,7 +19,7 @@ version_added: "1.0.0" options: name: description: - - The dot-separated path (also known as I(key)) specifying the sysctl variable. + - The dot-separated path (also known as O(key)) specifying the sysctl variable. required: true aliases: [ 'key' ] type: str @@ -41,8 +41,8 @@ options: default: false reload: description: - - If C(true), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is - updated. If C(false), does not reload I(sysctl) even if the + - 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 C(sysctl_file) is updated. type: bool default: true @@ -53,7 +53,7 @@ options: type: path sysctl_set: description: - - Verify token value with the sysctl command and set with -w if necessary. + - Verify token value with the sysctl command and set with C(-w) if necessary. type: bool default: false author: From ef07eb8a06197ce1fa504b89077ff815ecfe290f Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:49:33 +1200 Subject: [PATCH 07/42] Apply suggestions from code review Thanks felixfontein for the thorough review. :-) Co-authored-by: Felix Fontein --- plugins/modules/at.py | 2 +- plugins/modules/firewalld.py | 2 +- plugins/modules/mount.py | 8 ++++---- plugins/modules/synchronize.py | 6 +++--- plugins/modules/sysctl.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/modules/at.py b/plugins/modules/at.py index fefe6f2..9367ac2 100644 --- a/plugins/modules/at.py +++ b/plugins/modules/at.py @@ -36,7 +36,7 @@ options: choices: [ minutes, hours, days, weeks ] state: description: - - The state dictates if the command or script file should be evaluated as V(present)(added) or V(absent)(deleted). + - The state dictates if the command or script file should be evaluated as V(present) (added) or V(absent) (deleted). type: str choices: [ absent, present ] default: present diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index dc930ca..12dd27b 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -86,7 +86,7 @@ options: description: - Whether to apply this change to the permanent firewalld configuration. - As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9). - - Note that if this is V(false), O(immediate=true). + - Note that if this is V(false), O(immediate=true) by default. type: bool default: false immediate: diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 4fdd826..144f46e 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -24,20 +24,20 @@ options: path: description: - Path to the mount point (e.g. C(/mnt/files)). - - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile) and O(name). + - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile), and O(name). type: path required: true aliases: [ name ] src: description: - Device (or NFS volume, or something else) to be mounted on I(path). - - Required when O(state) set to V(present), V(mounted) or V(ephemeral). + - Required when O(state) set to V(present), V(mounted), or V(ephemeral). - Ignored when O(state) set to V(absent) or V(unmounted). type: path fstype: description: - Filesystem type. - - Required when O(state) is V(present), V(mounted) or V(ephemeral). + - Required when O(state) is V(present), V(mounted), or V(ephemeral). type: str opts: description: @@ -71,7 +71,7 @@ options: I(fstab) and does not trigger or require a mount. - V(ephemeral) only specifies that the device is to be mounted, without changing I(fstab). If it is already mounted, a remount will be triggered. - This will always return RV(ignore:changed=True). If the mount point O(path) + This will always return RV(ignore:changed=true). If the mount point O(path) has already a device mounted on, and its source is different than O(src), the module will fail to avoid unexpected unmount or mount point override. If the mount point is not present, the mount point will be created. diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 3c3ba25..d65e08f 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -52,7 +52,7 @@ options: default: push archive: description: - - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and C(-D). + - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags, and C(-D). type: bool default: true checksum: @@ -207,8 +207,8 @@ options: notes: - C(rsync) must be installed on both the local and remote host. - - For the M(ansible.posix.synchronize) module, the "local host" is the host `the synchronize task originates on`, - and the "destination host" is the host `synchronize is connecting to`. + - For the M(ansible.posix.synchronize) module, the "local host" is the host I(the synchronize task originates on), + and the "destination host" is the host I(synchronize is connecting to). - The "local host" can be changed to a different host by using C(delegate_to). This enables copying between two remote hosts or entirely on one remote machine. - > diff --git a/plugins/modules/sysctl.py b/plugins/modules/sysctl.py index 3d1242f..3edcc72 100644 --- a/plugins/modules/sysctl.py +++ b/plugins/modules/sysctl.py @@ -43,7 +43,7 @@ options: 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 - C(sysctl_file) is updated. + O(sysctl_file) is updated. type: bool default: true sysctl_file: From 3bff8d22a5081a4614cb3c0132cabb9bd29bb804 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 14:43:14 -0700 Subject: [PATCH 08/42] Update CI pipelines Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 48 ---------------------------- 1 file changed, 48 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 0169be1..27d28a1 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -98,19 +98,6 @@ stages: test: sanity - name: Units test: units - - stage: Sanity_2_14 - displayName: Ansible 2.14 sanity - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - nameFormat: "{0}" - testFormat: 2.14/{0} - targets: - - name: Sanity - test: sanity - - name: Units - test: units ## Docker - stage: Docker_devel displayName: Docker devel @@ -175,24 +162,6 @@ stages: test: ubuntu2004 - name: Ubuntu 22.04 test: ubuntu2204 - - stage: Docker_2_14 - displayName: Docker 2.14 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.14/linux/{0}/1 - targets: - - name: CentOS 7 - test: centos7 - - name: Fedora 36 - test: fedora36 - - name: openSUSE 15 py3 - test: opensuse15 - - name: Ubuntu 20.04 - test: ubuntu2004 - - name: Ubuntu 22.04 - test: ubuntu2204 ## Remote - stage: Remote_devel @@ -250,29 +219,12 @@ stages: test: rhel/9.1 - name: FreeBSD 13.2 test: freebsd/13.2 - - stage: Remote_2_14 - displayName: Remote 2.14 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.14/{0}/1 - targets: - - name: RHEL 7.9 - test: rhel/7.9 - - name: RHEL 8.6 - test: rhel/8.6 - - name: FreeBSD 13.2 - test: freebsd/13.2 ## Finally - stage: Summary condition: succeededOrFailed() dependsOn: - - Sanity_2_14 - - Remote_2_14 - - Docker_2_14 - Sanity_2_15 - Remote_2_15 - Docker_2_15 From 55fb80cf5e55fec5134d01f3bf30d4fc0a4638f1 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 15:16:36 -0700 Subject: [PATCH 09/42] CI fixes Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 6 ++++-- tests/utils/shippable/remote.sh | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 27d28a1..88c124d 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -172,8 +172,10 @@ stages: parameters: testFormat: devel/{0}/1 targets: - - name: RHEL 9.3 - test: rhel/9.3 + - name: RHEL 9.3 py39 + test: rhel/9.3@3.9 + - name: RHEL 9.3 py311 + test: rhel/9.3@3.11 - name: FreeBSD 13.3 test: freebsd/13.3 - stage: Remote_2_17 diff --git a/tests/utils/shippable/remote.sh b/tests/utils/shippable/remote.sh index cd3014c..a80b1a3 100755 --- a/tests/utils/shippable/remote.sh +++ b/tests/utils/shippable/remote.sh @@ -7,6 +7,16 @@ IFS='/:' read -ra args <<< "$1" platform="${args[0]}" version="${args[1]}" +pyver=default + +# check for explicit python version like 8.3@3.8 +declare -a splitversion +IFS='@' read -ra splitversion <<< "$version" + +if [ "${#splitversion[@]}" -gt 1 ]; then + version="${splitversion[0]}" + pyver="${splitversion[1]}" +fi if [ "${#args[@]}" -gt 2 ]; then target="shippable/posix/group${args[2]}/" @@ -19,4 +29,4 @@ provider="${P:-default}" # shellcheck disable=SC2086 ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ - --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" + --python "${pyver}" --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" From d2f1cc063adadd1db99c9bb2951b00d83c894e40 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 15:27:56 -0700 Subject: [PATCH 10/42] CI fixes Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/templates/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/templates/test.yml b/.azure-pipelines/templates/test.yml index 5250ed8..d6a4d5a 100644 --- a/.azure-pipelines/templates/test.yml +++ b/.azure-pipelines/templates/test.yml @@ -9,7 +9,7 @@ parameters: jobs: - ${{ each job in parameters.jobs }}: - - job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }} + - job: test_${{ replace(replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_'), '@', '_') }} displayName: ${{ job.name }} container: default workspace: From 0ea18d208f1e3e3e27cc7b000bed6ef0a0282ac2 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 15:58:43 -0700 Subject: [PATCH 11/42] remove RHEL9.3@3.11 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 88c124d..e1ad85f 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -174,8 +174,6 @@ stages: targets: - name: RHEL 9.3 py39 test: rhel/9.3@3.9 - - name: RHEL 9.3 py311 - test: rhel/9.3@3.11 - name: FreeBSD 13.3 test: freebsd/13.3 - stage: Remote_2_17 From af6b90981af6daa1a73e29fc5c2c4764cff6f480 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 16:06:40 -0700 Subject: [PATCH 12/42] Add Python version for Ubuntu and Fedora Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 12 ++++++------ tests/utils/shippable/linux.sh | 11 ++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index e1ad85f..5c6287b 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -107,12 +107,12 @@ stages: parameters: testFormat: devel/linux/{0}/1 targets: - - name: Fedora 39 - test: fedora39 - - name: Ubuntu 20.04 - test: ubuntu2004 - - name: Ubuntu 22.04 - test: ubuntu2204 + - name: Fedora 39 py311 + test: fedora39@3.11 + - name: Ubuntu 20.04 py39 + test: ubuntu2004@3.9 + - name: Ubuntu 22.04 py39 + test: ubuntu2204@3.9 - stage: Docker_2_17 displayName: Docker 2.17 dependsOn: [] diff --git a/tests/utils/shippable/linux.sh b/tests/utils/shippable/linux.sh index 9cc2f96..799e2a2 100755 --- a/tests/utils/shippable/linux.sh +++ b/tests/utils/shippable/linux.sh @@ -6,6 +6,15 @@ declare -a args IFS='/:' read -ra args <<< "$1" image="${args[1]}" +pyver=default +# check for explicit python version like 8.3@3.8 +declare -a splitversion +IFS='@' read -ra splitversion <<< "$image" + +if [ "${#splitversion[@]}" -gt 1 ]; then + image="${splitversion[0]}" + pyver="${splitversion[1]}" +fi if [ "${#args[@]}" -gt 2 ]; then target="shippable/posix/group${args[2]}/" @@ -15,4 +24,4 @@ fi # shellcheck disable=SC2086 ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ - --docker "${image}" + --docker "${image}" --python "${pyver}" From 271119d196bfc0964daf1cb3b92a737e0426d3b6 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 16:24:56 -0700 Subject: [PATCH 13/42] Update Ubuntu 2204 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 5c6287b..c73c3d4 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -109,8 +109,8 @@ stages: targets: - name: Fedora 39 py311 test: fedora39@3.11 - - name: Ubuntu 20.04 py39 - test: ubuntu2004@3.9 + - name: Ubuntu 20.04 py310 + test: ubuntu2004@3.10 - name: Ubuntu 22.04 py39 test: ubuntu2204@3.9 - stage: Docker_2_17 From d80fde7ea04bb4ff58ede8f396bf1dee580ffa8b Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 16:26:41 -0700 Subject: [PATCH 14/42] Update Ubuntu 2004 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index c73c3d4..5ed6235 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -107,12 +107,12 @@ stages: parameters: testFormat: devel/linux/{0}/1 targets: - - name: Fedora 39 py311 - test: fedora39@3.11 + - name: Fedora 39 + test: fedora39@default - name: Ubuntu 20.04 py310 test: ubuntu2004@3.10 - - name: Ubuntu 22.04 py39 - test: ubuntu2204@3.9 + - name: Ubuntu 22.04 + test: ubuntu2204@default - stage: Docker_2_17 displayName: Docker 2.17 dependsOn: [] From 39a9e79985fc239e8ac8212f3aa88ad35df846da Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 12 Jul 2024 16:31:01 -0700 Subject: [PATCH 15/42] Update Ubuntu 2004 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 5ed6235..995b7a6 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -107,8 +107,8 @@ stages: parameters: testFormat: devel/linux/{0}/1 targets: - - name: Fedora 39 - test: fedora39@default + - name: Fedora 39 py310 + test: fedora39@3.10 - name: Ubuntu 20.04 py310 test: ubuntu2004@3.10 - name: Ubuntu 22.04 From c29e8c213bdc5b209f3fe94150d9a26f9f1190d2 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Sat, 13 Jul 2024 08:23:29 -0700 Subject: [PATCH 16/42] Update Fedora 40 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 995b7a6..d68205e 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -107,8 +107,8 @@ stages: parameters: testFormat: devel/linux/{0}/1 targets: - - name: Fedora 39 py310 - test: fedora39@3.10 + - name: Fedora 40 + test: fedora40 - name: Ubuntu 20.04 py310 test: ubuntu2004@3.10 - name: Ubuntu 22.04 From 7b9eb8d56e08fd8d12fb38c4bce8c2d170827261 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Sat, 13 Jul 2024 08:35:59 -0700 Subject: [PATCH 17/42] Update Ubuntu 2004 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index d68205e..b30e930 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -109,8 +109,8 @@ stages: targets: - name: Fedora 40 test: fedora40 - - name: Ubuntu 20.04 py310 - test: ubuntu2004@3.10 + - name: Ubuntu 20.04 + test: ubuntu2004 - name: Ubuntu 22.04 test: ubuntu2204@default - stage: Docker_2_17 From 7bf56953cbd3cfa5b50201f44d7c0ee4fc86a173 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Sat, 13 Jul 2024 08:52:46 -0700 Subject: [PATCH 18/42] Update Ubuntu 2004 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index b30e930..98101d8 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -110,7 +110,7 @@ stages: - name: Fedora 40 test: fedora40 - name: Ubuntu 20.04 - test: ubuntu2004 + test: ubuntu2004@default - name: Ubuntu 22.04 test: ubuntu2204@default - stage: Docker_2_17 From c07ebc2f9c2f8b71124698fc7e29a13406772c54 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 15 Jul 2024 09:40:13 -0700 Subject: [PATCH 19/42] Update Ubuntu 2404 Signed-off-by: Abhijeet Kasurde --- .azure-pipelines/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 98101d8..f297c1f 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -109,8 +109,8 @@ stages: targets: - name: Fedora 40 test: fedora40 - - name: Ubuntu 20.04 - test: ubuntu2004@default + - name: Ubuntu 24.04 + test: ubuntu2404 - name: Ubuntu 22.04 test: ubuntu2204@default - stage: Docker_2_17 From 738a839ce5e1f340bcdc99c19deadb3804ebb1a9 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 15 Jul 2024 10:22:43 -0700 Subject: [PATCH 20/42] Remove unecessary changes to CI scripts --- .azure-pipelines/azure-pipelines.yml | 8 ++++---- tests/utils/shippable/linux.sh | 11 +---------- tests/utils/shippable/remote.sh | 12 +----------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index f297c1f..cc4a6ae 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -109,10 +109,10 @@ stages: targets: - name: Fedora 40 test: fedora40 + - name: Ubuntu 22.04 + test: ubuntu2204 - name: Ubuntu 24.04 test: ubuntu2404 - - name: Ubuntu 22.04 - test: ubuntu2204@default - stage: Docker_2_17 displayName: Docker 2.17 dependsOn: [] @@ -172,8 +172,8 @@ stages: parameters: testFormat: devel/{0}/1 targets: - - name: RHEL 9.3 py39 - test: rhel/9.3@3.9 + - name: RHEL 9.4 + test: rhel/9.4 - name: FreeBSD 13.3 test: freebsd/13.3 - stage: Remote_2_17 diff --git a/tests/utils/shippable/linux.sh b/tests/utils/shippable/linux.sh index 799e2a2..9cc2f96 100755 --- a/tests/utils/shippable/linux.sh +++ b/tests/utils/shippable/linux.sh @@ -6,15 +6,6 @@ declare -a args IFS='/:' read -ra args <<< "$1" image="${args[1]}" -pyver=default -# check for explicit python version like 8.3@3.8 -declare -a splitversion -IFS='@' read -ra splitversion <<< "$image" - -if [ "${#splitversion[@]}" -gt 1 ]; then - image="${splitversion[0]}" - pyver="${splitversion[1]}" -fi if [ "${#args[@]}" -gt 2 ]; then target="shippable/posix/group${args[2]}/" @@ -24,4 +15,4 @@ fi # shellcheck disable=SC2086 ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ - --docker "${image}" --python "${pyver}" + --docker "${image}" diff --git a/tests/utils/shippable/remote.sh b/tests/utils/shippable/remote.sh index a80b1a3..cd3014c 100755 --- a/tests/utils/shippable/remote.sh +++ b/tests/utils/shippable/remote.sh @@ -7,16 +7,6 @@ IFS='/:' read -ra args <<< "$1" platform="${args[0]}" version="${args[1]}" -pyver=default - -# check for explicit python version like 8.3@3.8 -declare -a splitversion -IFS='@' read -ra splitversion <<< "$version" - -if [ "${#splitversion[@]}" -gt 1 ]; then - version="${splitversion[0]}" - pyver="${splitversion[1]}" -fi if [ "${#args[@]}" -gt 2 ]; then target="shippable/posix/group${args[2]}/" @@ -29,4 +19,4 @@ provider="${P:-default}" # shellcheck disable=SC2086 ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ - --python "${pyver}" --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" + --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" From 41fc0901d9db406df69f707235d8e3a5bd330753 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 15 Jul 2024 10:25:20 -0700 Subject: [PATCH 21/42] Remove unecessary changes to CI scripts --- .azure-pipelines/templates/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/templates/test.yml b/.azure-pipelines/templates/test.yml index d6a4d5a..5250ed8 100644 --- a/.azure-pipelines/templates/test.yml +++ b/.azure-pipelines/templates/test.yml @@ -9,7 +9,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: default workspace: From 7d219a7e05f8a748b984d2755dda8fb7ce8f8473 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Mon, 19 Aug 2024 10:25:07 +0200 Subject: [PATCH 22/42] README: Add Communication section with Forum information (#557) * README: Add Communication section with Forum information * Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index d556096..d5f2ce1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,17 @@ https://dev.azure.com/ansible/ansible.posix/_apis/build/status/CI?branchName=mai An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and derivative Operating Systems. +## Communication + +* Join the Ansible forum: + * [Get Help](https://forum.ansible.com/c/help/6): get help or help others. + * [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts. + * [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events. + +* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes. + +For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html). + ## Supported Versions of Ansible ## Ansible version compatibility From f2d0b38b0eeefac8d27055eb20f8d0bada35a295 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 17 Jul 2024 15:19:57 -0700 Subject: [PATCH 23/42] Remove skippy callback Fixes: #350 Signed-off-by: Abhijeet Kasurde --- .github/BOTMETA.yml | 1 - .../fragments/556_remove_skippy_callback.yml | 2 + meta/runtime.yml | 6 --- plugins/callback/skippy.py | 43 ------------------- 4 files changed, 2 insertions(+), 50 deletions(-) create mode 100644 changelogs/fragments/556_remove_skippy_callback.yml delete mode 100644 plugins/callback/skippy.py diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml index 60ae92a..ba8b798 100644 --- a/.github/BOTMETA.yml +++ b/.github/BOTMETA.yml @@ -40,7 +40,6 @@ files: labels: debug $plugins/patch.py: labels: patch - $plugins/skippy.py: $plugins/synchronize.py: labels: synchronize $plugins/timer.py: diff --git a/changelogs/fragments/556_remove_skippy_callback.yml b/changelogs/fragments/556_remove_skippy_callback.yml new file mode 100644 index 0000000..57b19df --- /dev/null +++ b/changelogs/fragments/556_remove_skippy_callback.yml @@ -0,0 +1,2 @@ +removed_features: + - skippy - Remove skippy pluglin as it is no longer supported(https://github.com/ansible-collections/ansible.posix/issues/350). diff --git a/meta/runtime.yml b/meta/runtime.yml index a96714c..ce6befd 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,8 +1,2 @@ --- requires_ansible: ">=2.14.0" -plugin_routing: - callback: - skippy: - deprecation: - removal_date: "2022-06-01" - warning_text: See the plugin documentation for more details diff --git a/plugins/callback/skippy.py b/plugins/callback/skippy.py deleted file mode 100644 index ced28af..0000000 --- a/plugins/callback/skippy.py +++ /dev/null @@ -1,43 +0,0 @@ -# (c) 2012-2014, Michael DeHaan -# (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -DOCUMENTATION = ''' - name: skippy - type: stdout - requirements: - - set as main display callback - short_description: Ansible screen output that ignores skipped status - deprecated: - why: The 'default' callback plugin now supports this functionality - removed_at_date: '2022-06-01' - alternative: "'default' callback plugin with 'display_skipped_hosts = no' option" - extends_documentation_fragment: - - default_callback - description: - - This callback does the same as the default except it does not output skipped host/task/item status -''' - -from ansible.plugins.callback.default import CallbackModule as CallbackModule_default - - -class CallbackModule(CallbackModule_default): - - ''' - This is the default callback interface, which simply prints messages - to stdout when new callback events are received. - ''' - - CALLBACK_VERSION = 2.0 - CALLBACK_TYPE = 'stdout' - CALLBACK_NAME = 'ansible.posix.skippy' - - def v2_runner_on_skipped(self, result): - pass - - def v2_runner_item_on_skipped(self, result): - pass From 71b48d3b5f731bc1c1edb026dafe8cffc9958afd Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Fri, 6 Sep 2024 11:09:25 +0900 Subject: [PATCH 24/42] Drop ansible-core 2.14 and set 2.15 minimum version. Signed-off-by: Hideki Saito --- README.md | 6 +++--- changelogs/fragments/562_update_core_version.yml | 3 +++ meta/runtime.yml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/562_update_core_version.yml diff --git a/README.md b/README.md index d5f2ce1..84c59b4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ For more information about communication, see the [Ansible communication guide]( ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.14**. +This collection has been tested against following Ansible versions: **>=2.15**. ## Included content @@ -74,10 +74,10 @@ None -- ansible-core 2.17 (devel) +- ansible-core 2.18 (devel) +- ansible-core 2.17 (stable) - ansible-core 2.16 (stable) - ansible-core 2.15 (stable) -- ansible-core 2.14 (stable) ## Roadmap diff --git a/changelogs/fragments/562_update_core_version.yml b/changelogs/fragments/562_update_core_version.yml new file mode 100644 index 0000000..45cf88a --- /dev/null +++ b/changelogs/fragments/562_update_core_version.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - "Dropping support for ansible-core 2.14, ansible-core 2.15 will be minimum required version for this release" diff --git a/meta/runtime.yml b/meta/runtime.yml index ce6befd..1e85b01 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: ">=2.14.0" +requires_ansible: ">=2.15.0" From 257392f33d0679f0cdeb01cb1b2fd0a712802935 Mon Sep 17 00:00:00 2001 From: Gerlof Fokkema Date: Tue, 11 Jun 2024 11:34:48 +0200 Subject: [PATCH 25/42] Firewalld: Add functionality to set forwarding. Fixes #529. --- changelogs/fragments/548_add_foward.yml | 3 + plugins/modules/firewalld.py | 87 ++++++++++++++++++- .../firewalld/tasks/source_test_cases.yml | 5 +- .../firewalld/tasks/zone_test_cases.yml | 49 +++++++++++ 4 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/548_add_foward.yml diff --git a/changelogs/fragments/548_add_foward.yml b/changelogs/fragments/548_add_foward.yml new file mode 100644 index 0000000..2d41ccd --- /dev/null +++ b/changelogs/fragments/548_add_foward.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - firewalld - add functionality to set forwarding (https://github.com/ansible-collections/ansible.posix/pull/548). diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index 146990f..e7b3edf 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -108,6 +108,11 @@ options: - The amount of time in seconds the rule should be in effect for when non-permanent. type: int default: 0 + forward: + description: + - The forward setting you would like to enable/disable to/from zones within firewalld. + - This option only is supported by firewalld v0.9.0 or later. + type: str masquerade: description: - The masquerade setting you would like to enable/disable to/from zones within firewalld. @@ -138,8 +143,8 @@ notes: - This module needs C(python-firewall) or C(python3-firewall) on managed nodes. It is usually provided as a subset with C(firewalld) from the OS distributor for the OS default Python interpreter. requirements: -- firewalld >= 0.2.11 -- python-firewall >= 0.2.11 +- firewalld >= 0.9.0 +- python-firewall >= 0.9.0 author: - Adam Miller (@maxamillion) ''' @@ -198,6 +203,12 @@ EXAMPLES = r''' permanent: true state: enabled +- ansible.posix.firewalld: + forward: true + state: enabled + permanent: true + zone: internal + - ansible.posix.firewalld: masquerade: true state: enabled @@ -405,6 +416,49 @@ class ProtocolTransaction(FirewallTransaction): self.update_fw_settings(fw_zone, fw_settings) +class ForwardTransaction(FirewallTransaction): + """ + ForwardTransaction + """ + + def __init__(self, module, action_args=None, zone=None, desired_state=None, permanent=False, immediate=False): + super(ForwardTransaction, self).__init__( + module, action_args=action_args, desired_state=desired_state, zone=zone, permanent=permanent, immediate=immediate + ) + + self.enabled_msg = "Added forward to zone %s" % self.zone + self.disabled_msg = "Removed forward from zone %s" % self.zone + + def get_enabled_immediate(self): + if self.fw.queryForward(self.zone) is True: + return True + else: + return False + + def get_enabled_permanent(self): + fw_zone, fw_settings = self.get_fw_zone_settings() + if fw_settings.queryForward() is True: + return True + else: + return False + + def set_enabled_immediate(self): + self.fw.addForward(self.zone) + + def set_enabled_permanent(self): + fw_zone, fw_settings = self.get_fw_zone_settings() + fw_settings.setForward(True) + self.update_fw_settings(fw_zone, fw_settings) + + def set_disabled_immediate(self): + self.fw.removeForward(self.zone) + + def set_disabled_permanent(self): + fw_zone, fw_settings = self.get_fw_zone_settings() + fw_settings.setForward(False) + self.update_fw_settings(fw_zone, fw_settings) + + class MasqueradeTransaction(FirewallTransaction): """ MasqueradeTransaction @@ -821,6 +875,7 @@ def main(): state=dict(type='str', required=True, choices=['absent', 'disabled', 'enabled', 'present']), timeout=dict(type='int', default=0), interface=dict(type='str'), + forward=dict(type='str'), masquerade=dict(type='str'), offline=dict(type='bool', default=False), target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']), @@ -833,7 +888,7 @@ def main(): ), mutually_exclusive=[ ['icmp_block', 'icmp_block_inversion', 'service', 'protocol', 'port', 'port_forward', 'rich_rule', - 'interface', 'masquerade', 'source', 'target'] + 'interface', 'forward', 'masquerade', 'source', 'target'] ], ) @@ -842,6 +897,7 @@ def main(): immediate = module.params['immediate'] timeout = module.params['timeout'] interface = module.params['interface'] + forward = module.params['forward'] masquerade = module.params['masquerade'] offline = module.params['offline'] @@ -905,7 +961,7 @@ def main(): modification = False if any([icmp_block, icmp_block_inversion, service, protocol, port, port_forward, rich_rule, - interface, masquerade, source, target]): + interface, forward, masquerade, source, target]): modification = True if modification and desired_state in ['absent', 'present'] and target is None: module.fail_json( @@ -1072,6 +1128,29 @@ def main(): changed, transaction_msgs = transaction.run() msgs = msgs + transaction_msgs + if forward is not None: + # Type of forward will be changed to boolean in a future release. + forward_status = False + try: + forward_status = boolean(forward, False) + except TypeError: + module.warn('The value of the forward option is "%s". ' + 'The type of the option will be changed from string to boolean in a future release. ' + 'To avoid unexpected behavior, please change the value to boolean.' % forward) + + expected_state = 'enabled' if (desired_state == 'enabled') == forward_status else 'disabled' + transaction = ForwardTransaction( + module, + action_args=(), + zone=zone, + desired_state=expected_state, + permanent=permanent, + immediate=immediate, + ) + + changed, transaction_msgs = transaction.run() + msgs = msgs + transaction_msgs + if masquerade is not None: # Type of masquerade will be changed to boolean in a future release. masquerade_status = True diff --git a/tests/integration/targets/firewalld/tasks/source_test_cases.yml b/tests/integration/targets/firewalld/tasks/source_test_cases.yml index a2552d5..8b76521 100644 --- a/tests/integration/targets/firewalld/tasks/source_test_cases.yml +++ b/tests/integration/targets/firewalld/tasks/source_test_cases.yml @@ -83,5 +83,6 @@ ansible.builtin.assert: that: - result is not changed - - "result.msg == - 'parameters are mutually exclusive: icmp_block|icmp_block_inversion|service|protocol|port|port_forward|rich_rule|interface|masquerade|source|target'" + - > + result.msg == 'parameters are mutually exclusive: + icmp_block|icmp_block_inversion|service|protocol|port|port_forward|rich_rule|interface|forward|masquerade|source|target' diff --git a/tests/integration/targets/firewalld/tasks/zone_test_cases.yml b/tests/integration/targets/firewalld/tasks/zone_test_cases.yml index 753dd18..abb7b0f 100644 --- a/tests/integration/targets/firewalld/tasks/zone_test_cases.yml +++ b/tests/integration/targets/firewalld/tasks/zone_test_cases.yml @@ -23,6 +23,55 @@ that: - result is not changed +- name: Zone forwarding test + when: (ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>=')) + block: + - name: Enable zone forwarding + ansible.posix.firewalld: + zone: custom + forward: true + permanent: true + state: enabled + register: result + + - name: Assert zone forwarding is enabled + ansible.builtin.debug: + var: result is changed + + - name: Enable zone forwarding (verify not changed) + ansible.posix.firewalld: + zone: custom + forward: true + permanent: true + state: enabled + register: result + + - name: Assert zone forwarding is enabled (verify not changed) + ansible.builtin.debug: + var: result is not changed + + - name: Disable zone forwarding + ansible.posix.firewalld: + zone: custom + forward: false + permanent: true + state: enabled + + - name: Assert zone forwarding is disabled + ansible.builtin.debug: + var: result is changed + + - name: Disable zone forwarding (verify not changed) + ansible.posix.firewalld: + zone: custom + forward: false + permanent: true + state: enabled + + - name: Assert zone forwarding is disabled (verify not changed) + ansible.builtin.debug: + var: result is not changed + - name: Firewalld remove zone custom ansible.posix.firewalld: zone: custom From 4efdb43ccd1a576e829212657441de540a206135 Mon Sep 17 00:00:00 2001 From: k3it Date: Sat, 14 May 2022 15:16:03 -0400 Subject: [PATCH 26/42] maintain proper formating of the remote paths when defined as user@host:/... or host:/... * fixes #360 --- .../361_maintain_proper_formating_remote_paths.yml | 3 +++ plugins/action/synchronize.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/361_maintain_proper_formating_remote_paths.yml diff --git a/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml b/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml new file mode 100644 index 0000000..f370821 --- /dev/null +++ b/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361). diff --git a/plugins/action/synchronize.py b/plugins/action/synchronize.py index a5752b9..9d48e65 100644 --- a/plugins/action/synchronize.py +++ b/plugins/action/synchronize.py @@ -77,7 +77,14 @@ class ActionModule(ActionBase): if self._host_is_ipv6_address(host): return '[%s%s]:%s' % (user_prefix, host, path) - return '%s%s:%s' % (user_prefix, host, path) + + # preserve formatting of remote paths if host or user@host is explicitly defined in the path + if ':' not in path: + return '%s%s:%s' % (user_prefix, host, path) + elif '@' not in path: + return '%s%s' % (user_prefix, path) + else: + return path def _process_origin(self, host, path, user): From e00a4299c1a2d7e2a28795713db9de0522a6b326 Mon Sep 17 00:00:00 2001 From: dvillafana Date: Fri, 6 Sep 2024 16:30:28 -0500 Subject: [PATCH 27/42] (feat) add no_log options for 'opts' parameter * Fixed #497 --- .../fragments/563_add_no_log_option.yml | 3 ++ plugins/modules/mount.py | 11 ++++ .../integration/targets/mount/tasks/main.yml | 50 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 changelogs/fragments/563_add_no_log_option.yml diff --git a/changelogs/fragments/563_add_no_log_option.yml b/changelogs/fragments/563_add_no_log_option.yml new file mode 100644 index 0000000..fe11829 --- /dev/null +++ b/changelogs/fragments/563_add_no_log_option.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - mount - add no_log option for opts parameter (https://github.com/ansible-collections/ansible.posix/pull/563). diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 144f46e..fff7dc5 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -43,6 +43,12 @@ options: description: - Mount options (see fstab(5), or vfstab(4) on Solaris). type: str + opts_no_log: + description: + - Do not log opts. + type: bool + default: false + version_added: 1.6.0 dump: description: - Dump (see fstab(5)). @@ -209,6 +215,7 @@ EXAMPLES = r''' src: //192.168.1.200/share path: /mnt/smb_share opts: "rw,vers=3,file_mode=0600,dir_mode=0700,dom={{ ad_domain }},username={{ ad_username }},password={{ ad_password }}" + opts_no_log: true fstype: cifs state: ephemeral ''' @@ -768,6 +775,7 @@ def main(): fstype=dict(type='str'), path=dict(type='path', required=True, aliases=['name']), opts=dict(type='str'), + opts_no_log=dict(type='bool', default=False), passno=dict(type='str', no_log=False, default='0'), src=dict(type='path'), backup=dict(type='bool', default=False), @@ -781,6 +789,9 @@ def main(): ), ) + if module.params['opts_no_log']: + module.no_log_values.add(module.params['opts']) + # solaris args: # name, src, fstype, opts, boot, passno, state, fstab=/etc/vfstab # linux args: diff --git a/tests/integration/targets/mount/tasks/main.yml b/tests/integration/targets/mount/tasks/main.yml index 58eace8..15c6e89 100644 --- a/tests/integration/targets/mount/tasks/main.yml +++ b/tests/integration/targets/mount/tasks/main.yml @@ -739,3 +739,53 @@ - /tmp/myfs_A.img - /tmp/myfs_B.img - /tmp/myfs + +- name: Block to test opts_no_log option + when: ansible_system == 'Linux' + block: + - name: Create an empty file + community.general.filesize: + path: /tmp/myfs.img + size: 1M + - name: Format FS + community.general.filesystem: + fstype: ext4 + dev: /tmp/myfs.img + - name: Mount the FS with opts_no_log option true + ansible.posix.mount: + path: /tmp/myfs + src: /tmp/myfs.img + fstype: ext4 + state: mounted + opts: rw + opts_no_log: true + register: mount_info + - name: Assert opts_no_log option true + ansible.builtin.assert: + that: + - mount_info.opts == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' + - name: Remount the FS with opts_no_log option false + ansible.posix.mount: + path: /tmp/myfs + src: /tmp/myfs.img + fstype: ext4 + state: remounted + opts: rw,user + opts_no_log: false + register: mount_info + - name: Assert opts_no_log option false + ansible.builtin.assert: + that: + - mount_info.opts == 'rw,user' + always: + - name: Unmount FS + ansible.posix.mount: + path: /tmp/myfs + state: absent + - name: Remove the test FS + ansible.builtin.file: + path: '{{ item }}' + state: absent + loop: + - /tmp/myfs.img + - /tmp/myfs From 97c022871b58f74eae6386e7f342afc5df986ca8 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 11 Sep 2024 12:06:56 +0900 Subject: [PATCH 28/42] Release 1.6.0 commit Signed-off-by: Hideki Saito --- CHANGELOG.rst | 42 ++++++++++++++ changelogs/changelog.yaml | 58 +++++++++++++++++++ .../206_fix_sysctl_to_work_on_symlinks.yml | 3 - .../fragments/333_doc_absent_precision.yml | 4 -- ...maintain_proper_formating_remote_paths.yml | 3 - .../421-remove-deprecation-warning.yml | 2 - changelogs/fragments/460-respawn.yaml | 10 ---- changelogs/fragments/466-tests.yml | 2 - changelogs/fragments/477_ci_update.yml | 3 - .../fragments/484-firewalld-offline.yml | 2 - changelogs/fragments/487_ci_update.yml | 3 - .../fragments/490_doc_authorized_key_path.yml | 3 - ...ean-make-it-wrk-with-SELinux-disabled.yaml | 3 - .../fragments/504-firewalld_info-warning.yaml | 2 - changelogs/fragments/508_ci_update.yml | 3 - changelogs/fragments/510_ci_update.yml | 3 - ...e-callbacks-add-summary-only-parameter.yml | 3 - changelogs/fragments/548_add_foward.yml | 3 - .../fragments/556_remove_skippy_callback.yml | 2 - .../fragments/562_update_core_version.yml | 3 - .../fragments/563_add_no_log_option.yml | 3 - changelogs/fragments/dropping-ansible29.yml | 2 - changelogs/fragments/test-reqs.yml | 2 - galaxy.yml | 2 +- 24 files changed, 101 insertions(+), 65 deletions(-) delete mode 100644 changelogs/fragments/206_fix_sysctl_to_work_on_symlinks.yml delete mode 100644 changelogs/fragments/333_doc_absent_precision.yml delete mode 100644 changelogs/fragments/361_maintain_proper_formating_remote_paths.yml delete mode 100644 changelogs/fragments/421-remove-deprecation-warning.yml delete mode 100644 changelogs/fragments/460-respawn.yaml delete mode 100644 changelogs/fragments/466-tests.yml delete mode 100644 changelogs/fragments/477_ci_update.yml delete mode 100644 changelogs/fragments/484-firewalld-offline.yml delete mode 100644 changelogs/fragments/487_ci_update.yml delete mode 100644 changelogs/fragments/490_doc_authorized_key_path.yml delete mode 100644 changelogs/fragments/496_seboolean-make-it-wrk-with-SELinux-disabled.yaml delete mode 100644 changelogs/fragments/504-firewalld_info-warning.yaml delete mode 100644 changelogs/fragments/508_ci_update.yml delete mode 100644 changelogs/fragments/510_ci_update.yml delete mode 100644 changelogs/fragments/511_profile-callbacks-add-summary-only-parameter.yml delete mode 100644 changelogs/fragments/548_add_foward.yml delete mode 100644 changelogs/fragments/556_remove_skippy_callback.yml delete mode 100644 changelogs/fragments/562_update_core_version.yml delete mode 100644 changelogs/fragments/563_add_no_log_option.yml delete mode 100644 changelogs/fragments/dropping-ansible29.yml delete mode 100644 changelogs/fragments/test-reqs.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ffb9afa..8a844cc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,48 @@ ansible.posix Release Notes .. contents:: Topics +v1.6.0 +====== + +Release Summary +--------------- + +This is the minor release of the ``ansible.posix`` collection. +This changelog contains all changes to the modules and plugins +in this collection that have been added after the release of +``ansible.posix`` 1.5.4. + +Major Changes +------------- + +- Dropping support for Ansible 2.9, ansible-core 2.15 will be minimum required version for this release + +Minor Changes +------------- + +- Add summary_only parameter to profile_roles and profile_tasks callbacks. +- firewalld - add functionality to set forwarding (https://github.com/ansible-collections/ansible.posix/pull/548). +- firewalld - added offline flag implementation (https://github.com/ansible-collections/ansible.posix/pull/484) +- firewalld - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). +- firewalld_info - Only warn about ignored zones, when there are zones ignored. +- firewalld_info - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). +- mount - add no_log option for opts parameter (https://github.com/ansible-collections/ansible.posix/pull/563). +- seboolean - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). +- selinux - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). + +Removed Features (previously deprecated) +---------------------------------------- + +- skippy - Remove skippy pluglin as it is no longer supported(https://github.com/ansible-collections/ansible.posix/issues/350). + +Bugfixes +-------- + +- Bugfix in the documentation regarding the path option for authorised_key(https://github.com/ansible-collections/ansible.posix/issues/483). +- seboolean - make it work with disabled SELinux +- synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361). +- sysctl - fix sysctl to work properly on symlinks (https://github.com/ansible-collections/ansible.posix/issues/111). + v1.5.4 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 299f168..70ee8c8 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -347,3 +347,61 @@ releases: - 451_firewall_fix_protocol_parameter.yml - 456_sysctl_fix_nonetype.yml release_date: '2023-05-10' + 1.6.0: + changes: + bugfixes: + - Bugfix in the documentation regarding the path option for authorised_key(https://github.com/ansible-collections/ansible.posix/issues/483). + - seboolean - make it work with disabled SELinux + - synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361). + - sysctl - fix sysctl to work properly on symlinks (https://github.com/ansible-collections/ansible.posix/issues/111). + major_changes: + - Dropping support for Ansible 2.9, ansible-core 2.15 will be minimum required + version for this release + minor_changes: + - Add summary_only parameter to profile_roles and profile_tasks callbacks. + - firewalld - add functionality to set forwarding (https://github.com/ansible-collections/ansible.posix/pull/548). + - firewalld - added offline flag implementation (https://github.com/ansible-collections/ansible.posix/pull/484) + - firewalld - respawn module to use the system python interpreter when the ``firewall`` + python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). + - firewalld_info - Only warn about ignored zones, when there are zones ignored. + - firewalld_info - respawn module to use the system python interpreter when + the ``firewall`` python module is not available for ``ansible_python_interpreter`` + (https://github.com/ansible-collections/ansible.posix/pull/460). + - mount - add no_log option for opts parameter (https://github.com/ansible-collections/ansible.posix/pull/563). + - seboolean - respawn module to use the system python interpreter when the ``selinux`` + python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). + - selinux - respawn module to use the system python interpreter when the ``selinux`` + python module is not available for ``ansible_python_interpreter`` (https://github.com/ansible-collections/ansible.posix/pull/460). + release_summary: 'This is the minor release of the ``ansible.posix`` collection. + + This changelog contains all changes to the modules and plugins + + in this collection that have been added after the release of + + ``ansible.posix`` 1.5.4.' + removed_features: + - skippy - Remove skippy pluglin as it is no longer supported(https://github.com/ansible-collections/ansible.posix/issues/350). + fragments: + - 1.6.0.yml + - 206_fix_sysctl_to_work_on_symlinks.yml + - 333_doc_absent_precision.yml + - 361_maintain_proper_formating_remote_paths.yml + - 421-remove-deprecation-warning.yml + - 460-respawn.yaml + - 466-tests.yml + - 477_ci_update.yml + - 484-firewalld-offline.yml + - 487_ci_update.yml + - 490_doc_authorized_key_path.yml + - 496_seboolean-make-it-wrk-with-SELinux-disabled.yaml + - 504-firewalld_info-warning.yaml + - 508_ci_update.yml + - 510_ci_update.yml + - 511_profile-callbacks-add-summary-only-parameter.yml + - 548_add_foward.yml + - 556_remove_skippy_callback.yml + - 562_update_core_version.yml + - 563_add_no_log_option.yml + - dropping-ansible29.yml + - test-reqs.yml + release_date: '2024-09-11' diff --git a/changelogs/fragments/206_fix_sysctl_to_work_on_symlinks.yml b/changelogs/fragments/206_fix_sysctl_to_work_on_symlinks.yml deleted file mode 100644 index 703a6a2..0000000 --- a/changelogs/fragments/206_fix_sysctl_to_work_on_symlinks.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: -- sysctl - fix sysctl to work properly on symlinks (https://github.com/ansible-collections/ansible.posix/issues/111). diff --git a/changelogs/fragments/333_doc_absent_precision.yml b/changelogs/fragments/333_doc_absent_precision.yml deleted file mode 100644 index 42ee162..0000000 --- a/changelogs/fragments/333_doc_absent_precision.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -trivial: -- mount - fix description in the documentation of the state ``absent`` to match its actual behavior - and point out that ``src`` is ignored with state ``absent`` and ``unmounted`` (https://github.com/ansible-collections/ansible.posix/issues/322) diff --git a/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml b/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml deleted file mode 100644 index f370821..0000000 --- a/changelogs/fragments/361_maintain_proper_formating_remote_paths.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: -- synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361). diff --git a/changelogs/fragments/421-remove-deprecation-warning.yml b/changelogs/fragments/421-remove-deprecation-warning.yml deleted file mode 100644 index 5224f1e..0000000 --- a/changelogs/fragments/421-remove-deprecation-warning.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - synchronize - instantiate the connection plugin without the ``new_stdin`` argument, which is deprecated in ansible-core 2.15 (https://github.com/ansible-collections/ansible.posix/pull/421). diff --git a/changelogs/fragments/460-respawn.yaml b/changelogs/fragments/460-respawn.yaml deleted file mode 100644 index b88763b..0000000 --- a/changelogs/fragments/460-respawn.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -minor_changes: - - "seboolean - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter`` - (https://github.com/ansible-collections/ansible.posix/pull/460)." - - "selinux - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter`` - (https://github.com/ansible-collections/ansible.posix/pull/460)." - - "firewalld - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter`` - (https://github.com/ansible-collections/ansible.posix/pull/460)." - - "firewalld_info - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter`` - (https://github.com/ansible-collections/ansible.posix/pull/460)." diff --git a/changelogs/fragments/466-tests.yml b/changelogs/fragments/466-tests.yml deleted file mode 100644 index 3c08961..0000000 --- a/changelogs/fragments/466-tests.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Fix integration tests so they work with ansible-core devel / 2.16 (https://github.com/ansible-collections/ansible.posix/pull/466)." diff --git a/changelogs/fragments/477_ci_update.yml b/changelogs/fragments/477_ci_update.yml deleted file mode 100644 index 9429030..0000000 --- a/changelogs/fragments/477_ci_update.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - "Drop Python3.9 and update versions of RHEL,Fedora and FreeBSD for ansible-core:devel test(https://github.com/ansible-collections/ansible.posix/issues/476)." diff --git a/changelogs/fragments/484-firewalld-offline.yml b/changelogs/fragments/484-firewalld-offline.yml deleted file mode 100644 index c17d4ea..0000000 --- a/changelogs/fragments/484-firewalld-offline.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - firewalld - added offline flag implementation (https://github.com/ansible-collections/ansible.posix/pull/484) diff --git a/changelogs/fragments/487_ci_update.yml b/changelogs/fragments/487_ci_update.yml deleted file mode 100644 index b68da22..0000000 --- a/changelogs/fragments/487_ci_update.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - "Drop FreeBSD12.4 from CI for ansible-core:devel(https://github.com/ansible-collections/ansible.posix/issues/486)." diff --git a/changelogs/fragments/490_doc_authorized_key_path.yml b/changelogs/fragments/490_doc_authorized_key_path.yml deleted file mode 100644 index ba5311f..0000000 --- a/changelogs/fragments/490_doc_authorized_key_path.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - "Bugfix in the documentation regarding the path option for authorised_key(https://github.com/ansible-collections/ansible.posix/issues/483)." diff --git a/changelogs/fragments/496_seboolean-make-it-wrk-with-SELinux-disabled.yaml b/changelogs/fragments/496_seboolean-make-it-wrk-with-SELinux-disabled.yaml deleted file mode 100644 index e14cfa6..0000000 --- a/changelogs/fragments/496_seboolean-make-it-wrk-with-SELinux-disabled.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - seboolean - make it work with disabled SELinux diff --git a/changelogs/fragments/504-firewalld_info-warning.yaml b/changelogs/fragments/504-firewalld_info-warning.yaml deleted file mode 100644 index 73e00aa..0000000 --- a/changelogs/fragments/504-firewalld_info-warning.yaml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - firewalld_info - Only warn about ignored zones, when there are zones ignored. diff --git a/changelogs/fragments/508_ci_update.yml b/changelogs/fragments/508_ci_update.yml deleted file mode 100644 index a4af511..0000000 --- a/changelogs/fragments/508_ci_update.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - "Refactoring remote CI targets." diff --git a/changelogs/fragments/510_ci_update.yml b/changelogs/fragments/510_ci_update.yml deleted file mode 100644 index ada69ef..0000000 --- a/changelogs/fragments/510_ci_update.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - "Replace Fedora 38 with 39 for container test(https://github.com/ansible-collections/ansible.posix/issues/509)." diff --git a/changelogs/fragments/511_profile-callbacks-add-summary-only-parameter.yml b/changelogs/fragments/511_profile-callbacks-add-summary-only-parameter.yml deleted file mode 100644 index 2347dd3..0000000 --- a/changelogs/fragments/511_profile-callbacks-add-summary-only-parameter.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - "Add summary_only parameter to profile_roles and profile_tasks callbacks." diff --git a/changelogs/fragments/548_add_foward.yml b/changelogs/fragments/548_add_foward.yml deleted file mode 100644 index 2d41ccd..0000000 --- a/changelogs/fragments/548_add_foward.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - firewalld - add functionality to set forwarding (https://github.com/ansible-collections/ansible.posix/pull/548). diff --git a/changelogs/fragments/556_remove_skippy_callback.yml b/changelogs/fragments/556_remove_skippy_callback.yml deleted file mode 100644 index 57b19df..0000000 --- a/changelogs/fragments/556_remove_skippy_callback.yml +++ /dev/null @@ -1,2 +0,0 @@ -removed_features: - - skippy - Remove skippy pluglin as it is no longer supported(https://github.com/ansible-collections/ansible.posix/issues/350). diff --git a/changelogs/fragments/562_update_core_version.yml b/changelogs/fragments/562_update_core_version.yml deleted file mode 100644 index 45cf88a..0000000 --- a/changelogs/fragments/562_update_core_version.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - "Dropping support for ansible-core 2.14, ansible-core 2.15 will be minimum required version for this release" diff --git a/changelogs/fragments/563_add_no_log_option.yml b/changelogs/fragments/563_add_no_log_option.yml deleted file mode 100644 index fe11829..0000000 --- a/changelogs/fragments/563_add_no_log_option.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - mount - add no_log option for opts parameter (https://github.com/ansible-collections/ansible.posix/pull/563). diff --git a/changelogs/fragments/dropping-ansible29.yml b/changelogs/fragments/dropping-ansible29.yml deleted file mode 100644 index 78cd428..0000000 --- a/changelogs/fragments/dropping-ansible29.yml +++ /dev/null @@ -1,2 +0,0 @@ -major_changes: - - "Dropping support for Ansible 2.9, ansible-core 2.14 will be minimum required version for this release" diff --git a/changelogs/fragments/test-reqs.yml b/changelogs/fragments/test-reqs.yml deleted file mode 100644 index 11598f7..0000000 --- a/changelogs/fragments/test-reqs.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Move Galaxy test requirements from old transitional format in tests/requirements.yml to standard Ansible Galaxy requirements files in tests/integration/requirements.yml and tests/unit/requirements.yml." diff --git a/galaxy.yml b/galaxy.yml index 6b7009b..92fcf51 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: ansible name: posix -version: 1.5.4 +version: 1.6.0 readme: README.md authors: - Ansible (github.com/ansible) From 6ab205300594edbeac9177ec629b9bdc4bf18756 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Thu, 12 Sep 2024 10:41:07 +0900 Subject: [PATCH 29/42] Maintain galaxy.yml * Bump version to 1.6.1 to prepare the next release * Update document site link Signed-off-by: Hideki Saito --- changelogs/fragments/566_bump_version_161.yml | 3 +++ galaxy.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/566_bump_version_161.yml diff --git a/changelogs/fragments/566_bump_version_161.yml b/changelogs/fragments/566_bump_version_161.yml new file mode 100644 index 0000000..18bb513 --- /dev/null +++ b/changelogs/fragments/566_bump_version_161.yml @@ -0,0 +1,3 @@ +--- +trivial: + - Bump version to 1.6.1 for next release. diff --git a/galaxy.yml b/galaxy.yml index 92fcf51..8565e64 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: ansible name: posix -version: 1.6.0 +version: 1.6.1 readme: README.md authors: - Ansible (github.com/ansible) @@ -10,6 +10,6 @@ license_file: COPYING tags: [posix, networking, shell, unix] dependencies: {} repository: https://github.com/ansible-collections/ansible.posix -documentation: https://github.com/ansible-collections/ansible.posix/tree/main/docs +documentation: https://docs.ansible.com/ansible/latest/collections/ansible/posix/ homepage: https://github.com/ansible-collections/ansible.posix issues: https://github.com/ansible-collections/ansible.posix From e05b8507a4db5eccf8169467b31f0cc440c6c32b Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Fri, 13 Sep 2024 15:15:04 +0900 Subject: [PATCH 30/42] Remove wrong version_added section from mount module Signed-off-by: Hideki Saito --- changelogs/fragments/567_remove_version_added.yml | 3 +++ plugins/modules/mount.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/567_remove_version_added.yml diff --git a/changelogs/fragments/567_remove_version_added.yml b/changelogs/fragments/567_remove_version_added.yml new file mode 100644 index 0000000..12d0040 --- /dev/null +++ b/changelogs/fragments/567_remove_version_added.yml @@ -0,0 +1,3 @@ +--- +trivial: + - mount - remove wrong version_added section from ``opts_no_log``. diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index fff7dc5..fe9faff 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -48,7 +48,6 @@ options: - Do not log opts. type: bool default: false - version_added: 1.6.0 dump: description: - Dump (see fstab(5)). From c353e43a90b400d2de12100ea474a41559fff90d Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Thu, 19 Sep 2024 17:09:43 +0900 Subject: [PATCH 31/42] Fixed to set ACLs on paths mounted with NFSv4 correctly * Fixed #240 Signed-off-by: Hideki Saito --- changelogs/fragments/570_nfs4_acl.yml | 3 ++ plugins/modules/acl.py | 69 ++++++++++++++++++--------- 2 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 changelogs/fragments/570_nfs4_acl.yml diff --git a/changelogs/fragments/570_nfs4_acl.yml b/changelogs/fragments/570_nfs4_acl.yml new file mode 100644 index 0000000..a6a7f69 --- /dev/null +++ b/changelogs/fragments/570_nfs4_acl.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - acl - Fixed to set ACLs on paths mounted with NFS version 4 correctly (https://github.com/ansible-collections/ansible.posix/issues/240). diff --git a/plugins/modules/acl.py b/plugins/modules/acl.py index acde18b..4cc94e7 100644 --- a/plugins/modules/acl.py +++ b/plugins/modules/acl.py @@ -75,6 +75,10 @@ options: use_nfsv4_acls: description: - Use NFSv4 ACLs instead of POSIX ACLs. + - This feature uses C(nfs4_setfacl) and C(nfs4_getfacl). The behavior depends on those implementation. + And currently it only supports C(A) in ACE, so C(D) must be replaced with the appropriate C(A). + - Permission is set as optimised ACLs by the system. You can check the actual ACLs that has been set using the return value. + - More info C(man nfs4_setfacl) type: bool default: false recalculate_mask: @@ -179,7 +183,7 @@ def split_entry(entry): def build_entry(etype, entity, permissions=None, use_nfsv4_acls=False): '''Builds and returns an entry string. Does not include the permissions bit if they are not provided.''' if use_nfsv4_acls: - return ':'.join([etype, entity, permissions, 'allow']) + return ':'.join(['A', 'g' if etype == 'group' else '', entity, permissions + 'tcy']) if permissions: return etype + ':' + entity + ':' + permissions @@ -187,22 +191,27 @@ def build_entry(etype, entity, permissions=None, use_nfsv4_acls=False): return etype + ':' + entity -def build_command(module, mode, path, follow, default, recursive, recalculate_mask, entry=''): +def build_command(module, mode, path, follow, default, recursive, recalculate_mask, use_nfsv4_acls, entry=''): '''Builds and returns a getfacl/setfacl command.''' if mode == 'set': - cmd = [module.get_bin_path('setfacl', True)] - cmd.extend(['-m', entry]) + cmd = [module.get_bin_path('nfs4_setfacl' if use_nfsv4_acls else 'setfacl', True)] + cmd.extend(['-a' if use_nfsv4_acls else '-m', entry]) elif mode == 'rm': - cmd = [module.get_bin_path('setfacl', True)] + cmd = [module.get_bin_path('nfs4_setfacl' if use_nfsv4_acls else 'setfacl', True)] cmd.extend(['-x', entry]) else: # mode == 'get' cmd = [module.get_bin_path('getfacl', True)] # prevents absolute path warnings and removes headers if platform.system().lower() == 'linux': + if use_nfsv4_acls: + # use nfs4_getfacl instead of getfacl if use_nfsv4_acls is True + cmd = [module.get_bin_path('nfs4_getfacl', True)] + else: + cmd = [module.get_bin_path('getfacl', True)] + cmd.append('--absolute-names') cmd.append('--omit-header') - cmd.append('--absolute-names') - if recursive: + if recursive and not use_nfsv4_acls: cmd.append('--recursive') if recalculate_mask == 'mask' and mode in ['set', 'rm']: @@ -210,7 +219,7 @@ def build_command(module, mode, path, follow, default, recursive, recalculate_ma elif recalculate_mask == 'no_mask' and mode in ['set', 'rm']: cmd.append('--no-mask') - if not follow: + if not follow and not use_nfsv4_acls: if platform.system().lower() == 'linux': cmd.append('--physical') elif platform.system().lower() == 'freebsd': @@ -223,24 +232,34 @@ def build_command(module, mode, path, follow, default, recursive, recalculate_ma return cmd -def acl_changed(module, cmd): +def acl_changed(module, cmd, entry, use_nfsv4_acls=False): '''Returns true if the provided command affects the existing ACLs, false otherwise.''' - # FreeBSD do not have a --test flag, so by default, it is safer to always say "true" + # To check the ACL changes, use the output of setfacl or nfs4_setfacl with '--test'. + # FreeBSD do not have a --test flag, so by default, it is safer to always say "true". if platform.system().lower() == 'freebsd': return True cmd = cmd[:] # lists are mutables so cmd would be overwritten without this cmd.insert(1, '--test') lines = run_acl(module, cmd) - + counter = 0 for line in lines: - if not line.endswith('*,*'): - return True - return False + if line.endswith('*,*') and not use_nfsv4_acls: + return False + # if use_nfsv4_acls and entry is listed + if use_nfsv4_acls and entry == line: + counter += 1 + + # The current 'nfs4_setfacl --test' lists a new entry, + # which will be added at the top of list, followed by the existing entries. + # So if the entry has already been registered, the entry should be find twice. + if counter == 2: + return False + return True def run_acl(module, cmd, check_rc=True): - + '''Runs the provided command and returns the output as a list of lines.''' try: (rc, out, err) = module.run_command(cmd, check_rc=check_rc) except Exception as e: @@ -313,7 +332,7 @@ def main(): module.fail_json(msg="'recalculate_mask' MUST NOT be set to 'mask' or 'no_mask' when 'state=query'.") if not entry: - if state == 'absent' and permissions: + if state == 'absent' and permissions and not use_nfsv4_acls: module.fail_json(msg="'permissions' MUST NOT be set when 'state=absent'.") if state == 'absent' and not entity: @@ -350,21 +369,24 @@ def main(): entry = build_entry(etype, entity, permissions, use_nfsv4_acls) command = build_command( module, 'set', path, follow, - default, recursive, recalculate_mask, entry + default, recursive, recalculate_mask, use_nfsv4_acls, entry ) - changed = acl_changed(module, command) + changed = acl_changed(module, command, entry, use_nfsv4_acls) if changed and not module.check_mode: run_acl(module, command) msg = "%s is present" % entry elif state == 'absent': - entry = build_entry(etype, entity, use_nfsv4_acls) + if use_nfsv4_acls: + entry = build_entry(etype, entity, permissions, use_nfsv4_acls) + else: + entry = build_entry(etype, entity, use_nfsv4_acls) command = build_command( module, 'rm', path, follow, - default, recursive, recalculate_mask, entry + default, recursive, recalculate_mask, use_nfsv4_acls, entry ) - changed = acl_changed(module, command) + changed = acl_changed(module, command, entry, use_nfsv4_acls) if changed and not module.check_mode: run_acl(module, command, False) @@ -375,7 +397,10 @@ def main(): acl = run_acl( module, - build_command(module, 'get', path, follow, default, recursive, recalculate_mask) + build_command( + module, 'get', path, follow, default, recursive, + recalculate_mask, use_nfsv4_acls + ) ) module.exit_json(changed=changed, msg=msg, acl=acl) From 7194b6bb1377e9d4c2ac988ce9510b8d7e358d14 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 25 Sep 2024 09:10:22 +0900 Subject: [PATCH 32/42] CI - bump ansible-core version * bump devel test to ansible-core 2.19 * add ansible-core 2.18 to stable list but CI only covers sanity test at the moment. Signed-off-by: Hideki Saito --- .azure-pipelines/azure-pipelines.yml | 48 ++++++++++++++++++- README.md | 5 +- .../fragments/571_ci_bump_core_version.yml | 3 ++ tests/sanity/ignore-2.19.txt | 1 + 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/571_ci_bump_core_version.yml create mode 100644 tests/sanity/ignore-2.19.txt diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index cc4a6ae..7c7ec26 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -57,6 +57,21 @@ stages: test: units - name: Lint test: lint + - stage: Sanity_2_18 + displayName: Ansible 2.18 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: 2.18/{0} + targets: + - name: Sanity + test: sanity + - name: Units + test: units + - name: Lint + test: lint - stage: Sanity_2_17 displayName: Ansible 2.17 sanity dependsOn: [] @@ -113,6 +128,20 @@ stages: test: ubuntu2204 - name: Ubuntu 24.04 test: ubuntu2404 + - stage: Docker_2_18 + displayName: Docker devel + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + testFormat: 2.18/linux/{0}/1 + targets: + - name: Fedora 40 + test: fedora40 + - name: Ubuntu 22.04 + test: ubuntu2204 + - name: Ubuntu 24.04 + test: ubuntu2404 - stage: Docker_2_17 displayName: Docker 2.17 dependsOn: [] @@ -176,6 +205,18 @@ stages: test: rhel/9.4 - name: FreeBSD 13.3 test: freebsd/13.3 + - stage: Remote_2_18 + displayName: Remote devel + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + testFormat: 2.18/{0}/1 + targets: + - name: RHEL 9.4 + test: rhel/9.4 + - name: FreeBSD 13.3 + test: freebsd/13.3 - stage: Remote_2_17 displayName: Remote 2.17 dependsOn: [] @@ -234,8 +275,11 @@ stages: - Sanity_2_17 - Remote_2_17 - Docker_2_17 + - Sanity_2_18 + - Remote_2_18 + - Docker_2_18 - Sanity_devel - - Remote_devel - - Docker_devel + # - Remote_devel # Wait for test environment release + # - Docker_devel # Wait for test environment release jobs: - template: templates/coverage.yml diff --git a/README.md b/README.md index 84c59b4..ddbbb1b 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,14 @@ None -- ansible-core 2.18 (devel) +- ansible-core 2.19 (devel) +- ansible-core 2.18 (stable) * - ansible-core 2.17 (stable) - ansible-core 2.16 (stable) - ansible-core 2.15 (stable) +*Note: For ansible-core 2.18, CI only covers sanity tests and no integration tests will be run until the test environment is released.* + ## Roadmap diff --git a/changelogs/fragments/571_ci_bump_core_version.yml b/changelogs/fragments/571_ci_bump_core_version.yml new file mode 100644 index 0000000..bec2e29 --- /dev/null +++ b/changelogs/fragments/571_ci_bump_core_version.yml @@ -0,0 +1,3 @@ +--- +trivial: + - Bump ansible-core version to 2.19 of devel branch and add 2.18 to CI. diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-2.19.txt new file mode 100644 index 0000000..3cf68c0 --- /dev/null +++ b/tests/sanity/ignore-2.19.txt @@ -0,0 +1 @@ +tests/utils/shippable/timing.py shebang From 5f3f8514ebcd8c64d13f8cdb86864bd8f9ab993c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=91=D0=B0=D0=BA=D0=B0=D0=BD=D0=BE=D0=B2=D1=81=D0=BA=D0=B8?= =?UTF-8?q?=D0=B9?= Date: Tue, 17 Sep 2024 17:26:17 +0300 Subject: [PATCH 33/42] Allow remote path for authorized_key --- .../fragments/568_update_authorized_key.yml | 3 ++ plugins/modules/authorized_key.py | 23 ++++++++++++- .../targets/authorized_key/defaults/main.yml | 2 ++ .../authorized_key/tasks/check_path.yml | 32 +++++++++++++++++++ .../targets/authorized_key/tasks/main.yml | 3 ++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/568_update_authorized_key.yml create mode 100644 tests/integration/targets/authorized_key/tasks/check_path.yml diff --git a/changelogs/fragments/568_update_authorized_key.yml b/changelogs/fragments/568_update_authorized_key.yml new file mode 100644 index 0000000..7efa29c --- /dev/null +++ b/changelogs/fragments/568_update_authorized_key.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - authorized_keys - allow using absolute path to a file as a SSH key(s) source (https://github.com/ansible-collections/ansible.posix/pull/568) diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 9fbc610..1d68b4e 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -24,6 +24,7 @@ options: key: description: - The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys). + - You can also use V(file://) prefix to search remote for a file with SSH key(s). type: str required: true path: @@ -96,6 +97,12 @@ EXAMPLES = r''' state: present key: https://github.com/charlie.keys +- name: Set authorized keys taken from path on controller node + ansible.posix.authorized_key: + user: charlie + state: present + key: file:///home/charlie/.ssh/id_rsa.pub + - name: Set authorized keys taken from url using lookup ansible.posix.authorized_key: user: charlie @@ -223,6 +230,7 @@ from operator import itemgetter from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url +from ansible.module_utils.six.moves.urllib.parse import urlparse class keydict(dict): @@ -556,7 +564,7 @@ def enforce_state(module, params): follow = params.get('follow', False) error_msg = "Error getting key from: %s" - # if the key is a url, request it and use it as key source + # if the key is a url or file, request it and use it as key source if key.startswith("http"): try: resp, info = fetch_url(module, key) @@ -570,6 +578,19 @@ def enforce_state(module, params): # resp.read gives bytes on python3, convert to native string type key = to_native(key, errors='surrogate_or_strict') + if key.startswith("file"): + # if the key is an absolute path, check for existense and use it as a key source + key_path = urlparse(key).path + if not os.path.exists(key_path): + module.fail_json(msg="Path to a key file not found: %s" % key_path) + if not os.path.isfile(key_path): + module.fail_json(msg="Path to a key is a directory and must be a file: %s" % key_path) + try: + with open(key_path, 'r') as source_fh: + key = source_fh.read() + except OSError as e: + module.fail_json(msg="Failed to read key file %s : %s" % (key_path, to_native(e))) + # extract individual keys into an array, skipping blank lines and comments new_keys = [s for s in key.splitlines() if s and not s.startswith('#')] diff --git a/tests/integration/targets/authorized_key/defaults/main.yml b/tests/integration/targets/authorized_key/defaults/main.yml index 1b60f8c..7ec99ca 100644 --- a/tests/integration/targets/authorized_key/defaults/main.yml +++ b/tests/integration/targets/authorized_key/defaults/main.yml @@ -35,3 +35,5 @@ multiple_keys_comments: | ssh-rsa DATA_BASIC 1@testing # I like adding comments yo-dude-this-is-not-a-key INVALID_DATA 2@testing ecdsa-sha2-nistp521 ECDSA_DATA 4@testing + +key_path: /tmp/id_rsa.pub diff --git a/tests/integration/targets/authorized_key/tasks/check_path.yml b/tests/integration/targets/authorized_key/tasks/check_path.yml new file mode 100644 index 0000000..df5d46e --- /dev/null +++ b/tests/integration/targets/authorized_key/tasks/check_path.yml @@ -0,0 +1,32 @@ +--- +- name: Create key file for test + ansible.builtin.copy: + dest: "{{ key_path }}" + content: "{{ rsa_key_basic }}" + mode: "0600" + +- name: Add key using path + ansible.posix.authorized_key: + user: root + key: file://{{ key_path }} + state: present + path: "{{ output_dir | expanduser }}/authorized_keys" + register: result + +- name: Assert that the key was added + ansible.builtin.assert: + that: + - result.changed == true + +- name: Add key using path again + ansible.posix.authorized_key: + user: root + key: file://{{ key_path }} + state: present + path: "{{ output_dir | expanduser }}/authorized_keys" + register: result + +- name: Assert that no changes were applied + ansible.builtin.assert: + that: + - result.changed == false diff --git a/tests/integration/targets/authorized_key/tasks/main.yml b/tests/integration/targets/authorized_key/tasks/main.yml index 6a22838..d687f17 100644 --- a/tests/integration/targets/authorized_key/tasks/main.yml +++ b/tests/integration/targets/authorized_key/tasks/main.yml @@ -31,3 +31,6 @@ - name: Test for the management of comments with key ansible.builtin.import_tasks: comments.yml + +- name: Test for specifying key as a path + ansible.builtin.import_tasks: check_path.yml From afa724ba8a1453cc78d64c43bd3b64e113a37f58 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 20 Sep 2022 14:38:08 -0700 Subject: [PATCH 34/42] Improve callback output to align header with roles, tasks and play RECAP --- changelogs/fragments/387_callback_output_header.yml | 3 +++ plugins/callback/profile_roles.py | 5 ++++- plugins/callback/profile_tasks.py | 5 ++++- plugins/callback/timer.py | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/387_callback_output_header.yml diff --git a/changelogs/fragments/387_callback_output_header.yml b/changelogs/fragments/387_callback_output_header.yml new file mode 100644 index 0000000..5eb8573 --- /dev/null +++ b/changelogs/fragments/387_callback_output_header.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - callback plugins - Add recap information to timer, profile_roles and profile_tasks callback outputs (https://github.com/ansible-collections/ansible.posix/pull/387). diff --git a/plugins/callback/profile_roles.py b/plugins/callback/profile_roles.py index 59a437f..270a74f 100644 --- a/plugins/callback/profile_roles.py +++ b/plugins/callback/profile_roles.py @@ -128,7 +128,10 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("ROLES RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/profile_tasks.py b/plugins/callback/profile_tasks.py index 5fb7972..c5cc5fe 100644 --- a/plugins/callback/profile_tasks.py +++ b/plugins/callback/profile_tasks.py @@ -193,7 +193,10 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("TASKS RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/timer.py b/plugins/callback/timer.py index 3ef9255..e2eca05 100644 --- a/plugins/callback/timer.py +++ b/plugins/callback/timer.py @@ -46,4 +46,6 @@ class CallbackModule(CallbackBase): def v2_playbook_on_stats(self, stats): end_time = datetime.utcnow() runtime = end_time - self.start_time - self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % (self.days_hours_minutes_seconds(runtime))) + # Align summary report header with other callback plugin summary + self._display.banner("PLAYBOOK RECAP") + self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds\n\r" % (self.days_hours_minutes_seconds(runtime))) From 2041e7f918be45cf56ba4000518d5b06157c7df7 Mon Sep 17 00:00:00 2001 From: copyrights Date: Mon, 23 May 2022 22:21:11 +0200 Subject: [PATCH 35/42] mount: remove boot exception if defaults in opts --- changelogs/fragments/365-boot-linux.yml | 3 +++ plugins/modules/mount.py | 7 ++----- .../integration/targets/mount/tasks/main.yml | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/365-boot-linux.yml diff --git a/changelogs/fragments/365-boot-linux.yml b/changelogs/fragments/365-boot-linux.yml new file mode 100644 index 0000000..ec88776 --- /dev/null +++ b/changelogs/fragments/365-boot-linux.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - mount - Handle ``boot`` option on Linux, NetBSD and OpenBSD correctly (https://github.com/ansible-collections/ansible.posix/issues/364). diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index fe9faff..dadbd46 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -850,11 +850,8 @@ def main(): args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'noauto'.") elif not module.params['boot']: args['boot'] = 'no' - if 'defaults' in opts: - args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'defaults'.") - else: - opts.append('noauto') - args['opts'] = ','.join(opts) + opts.append('noauto') + args['opts'] = ','.join(opts) # If fstab file does not exist, we first need to create it. This mainly # happens when fstab option is passed to the module. diff --git a/tests/integration/targets/mount/tasks/main.yml b/tests/integration/targets/mount/tasks/main.yml index 15c6e89..bb91648 100644 --- a/tests/integration/targets/mount/tasks/main.yml +++ b/tests/integration/targets/mount/tasks/main.yml @@ -472,6 +472,25 @@ path: /tmp/myfs state: absent + - name: Mount the FS with noauto option and defaults + ansible.posix.mount: + path: /tmp/myfs + src: /tmp/myfs.img + fstype: ext3 + state: mounted + boot: false + register: mount_info + + - name: Assert the mount without noauto was successful + ansible.builtin.assert: + that: + - "'noauto' in mount_info['opts'].split(',')" + + - name: Unmount FS + ansible.posix.mount: + path: /tmp/myfs + state: absent + - name: Remove the test FS ansible.builtin.file: path: '{{ item }}' From cd43bd10bbf4401582ef2305dfc74286b9da05a2 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:32:23 +0900 Subject: [PATCH 36/42] Revert "Merge pull request #556 from Akasurde/i350" This reverts commit 9a2ddcd713c9337ba70942028ff52bb868acfabd, reversing changes made to 7d219a7e05f8a748b984d2755dda8fb7ce8f8473. --- .github/BOTMETA.yml | 1 + meta/runtime.yml | 8 ++++++- plugins/callback/skippy.py | 43 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 plugins/callback/skippy.py diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml index ba8b798..60ae92a 100644 --- a/.github/BOTMETA.yml +++ b/.github/BOTMETA.yml @@ -40,6 +40,7 @@ files: labels: debug $plugins/patch.py: labels: patch + $plugins/skippy.py: $plugins/synchronize.py: labels: synchronize $plugins/timer.py: diff --git a/meta/runtime.yml b/meta/runtime.yml index 1e85b01..a96714c 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,8 @@ --- -requires_ansible: ">=2.15.0" +requires_ansible: ">=2.14.0" +plugin_routing: + callback: + skippy: + deprecation: + removal_date: "2022-06-01" + warning_text: See the plugin documentation for more details diff --git a/plugins/callback/skippy.py b/plugins/callback/skippy.py new file mode 100644 index 0000000..ced28af --- /dev/null +++ b/plugins/callback/skippy.py @@ -0,0 +1,43 @@ +# (c) 2012-2014, Michael DeHaan +# (c) 2017 Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +DOCUMENTATION = ''' + name: skippy + type: stdout + requirements: + - set as main display callback + short_description: Ansible screen output that ignores skipped status + deprecated: + why: The 'default' callback plugin now supports this functionality + removed_at_date: '2022-06-01' + alternative: "'default' callback plugin with 'display_skipped_hosts = no' option" + extends_documentation_fragment: + - default_callback + description: + - This callback does the same as the default except it does not output skipped host/task/item status +''' + +from ansible.plugins.callback.default import CallbackModule as CallbackModule_default + + +class CallbackModule(CallbackModule_default): + + ''' + This is the default callback interface, which simply prints messages + to stdout when new callback events are received. + ''' + + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'stdout' + CALLBACK_NAME = 'ansible.posix.skippy' + + def v2_runner_on_skipped(self, result): + pass + + def v2_runner_item_on_skipped(self, result): + pass From 3a085b0b10e33395630733d4368d408fc781a48d Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:32:45 +0900 Subject: [PATCH 37/42] Revert "Merge pull request #387 from ansiblejunky/fix-callback-output" This reverts commit f4baa4c6d8e5ec989887a2b5f4abde24c9e12cbb, reversing changes made to 0821768bcbac58ace4fdf0c95b89007a925d6556. --- changelogs/fragments/387_callback_output_header.yml | 3 --- plugins/callback/profile_roles.py | 5 +---- plugins/callback/profile_tasks.py | 5 +---- plugins/callback/timer.py | 4 +--- 4 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 changelogs/fragments/387_callback_output_header.yml diff --git a/changelogs/fragments/387_callback_output_header.yml b/changelogs/fragments/387_callback_output_header.yml deleted file mode 100644 index 5eb8573..0000000 --- a/changelogs/fragments/387_callback_output_header.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - callback plugins - Add recap information to timer, profile_roles and profile_tasks callback outputs (https://github.com/ansible-collections/ansible.posix/pull/387). diff --git a/plugins/callback/profile_roles.py b/plugins/callback/profile_roles.py index 270a74f..59a437f 100644 --- a/plugins/callback/profile_roles.py +++ b/plugins/callback/profile_roles.py @@ -128,10 +128,7 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - # Align summary report header with other callback plugin summary - self._display.banner("ROLES RECAP") - - self._display.display(tasktime()) + self._display_tasktime() self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/profile_tasks.py b/plugins/callback/profile_tasks.py index c5cc5fe..5fb7972 100644 --- a/plugins/callback/profile_tasks.py +++ b/plugins/callback/profile_tasks.py @@ -193,10 +193,7 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - # Align summary report header with other callback plugin summary - self._display.banner("TASKS RECAP") - - self._display.display(tasktime()) + self._display_tasktime() self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/timer.py b/plugins/callback/timer.py index e2eca05..3ef9255 100644 --- a/plugins/callback/timer.py +++ b/plugins/callback/timer.py @@ -46,6 +46,4 @@ class CallbackModule(CallbackBase): def v2_playbook_on_stats(self, stats): end_time = datetime.utcnow() runtime = end_time - self.start_time - # Align summary report header with other callback plugin summary - self._display.banner("PLAYBOOK RECAP") - self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds\n\r" % (self.days_hours_minutes_seconds(runtime))) + self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % (self.days_hours_minutes_seconds(runtime))) From 098b5bee701554b0b533eb0d2ef8fca45b8ee456 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:33:16 +0900 Subject: [PATCH 38/42] Revert "Merge pull request #568 from abakanovskii/feature/add_path_option_authorized_key" This reverts commit 0821768bcbac58ace4fdf0c95b89007a925d6556, reversing changes made to 5321a9ecb58a1b840a9256725ca45f35c28da8c4. --- .../fragments/568_update_authorized_key.yml | 3 -- plugins/modules/authorized_key.py | 23 +------------ .../targets/authorized_key/defaults/main.yml | 2 -- .../authorized_key/tasks/check_path.yml | 32 ------------------- .../targets/authorized_key/tasks/main.yml | 3 -- 5 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 changelogs/fragments/568_update_authorized_key.yml delete mode 100644 tests/integration/targets/authorized_key/tasks/check_path.yml diff --git a/changelogs/fragments/568_update_authorized_key.yml b/changelogs/fragments/568_update_authorized_key.yml deleted file mode 100644 index 7efa29c..0000000 --- a/changelogs/fragments/568_update_authorized_key.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - authorized_keys - allow using absolute path to a file as a SSH key(s) source (https://github.com/ansible-collections/ansible.posix/pull/568) diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 1d68b4e..9fbc610 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -24,7 +24,6 @@ options: key: description: - The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys). - - You can also use V(file://) prefix to search remote for a file with SSH key(s). type: str required: true path: @@ -97,12 +96,6 @@ EXAMPLES = r''' state: present key: https://github.com/charlie.keys -- name: Set authorized keys taken from path on controller node - ansible.posix.authorized_key: - user: charlie - state: present - key: file:///home/charlie/.ssh/id_rsa.pub - - name: Set authorized keys taken from url using lookup ansible.posix.authorized_key: user: charlie @@ -230,7 +223,6 @@ from operator import itemgetter from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url -from ansible.module_utils.six.moves.urllib.parse import urlparse class keydict(dict): @@ -564,7 +556,7 @@ def enforce_state(module, params): follow = params.get('follow', False) error_msg = "Error getting key from: %s" - # if the key is a url or file, request it and use it as key source + # if the key is a url, request it and use it as key source if key.startswith("http"): try: resp, info = fetch_url(module, key) @@ -578,19 +570,6 @@ def enforce_state(module, params): # resp.read gives bytes on python3, convert to native string type key = to_native(key, errors='surrogate_or_strict') - if key.startswith("file"): - # if the key is an absolute path, check for existense and use it as a key source - key_path = urlparse(key).path - if not os.path.exists(key_path): - module.fail_json(msg="Path to a key file not found: %s" % key_path) - if not os.path.isfile(key_path): - module.fail_json(msg="Path to a key is a directory and must be a file: %s" % key_path) - try: - with open(key_path, 'r') as source_fh: - key = source_fh.read() - except OSError as e: - module.fail_json(msg="Failed to read key file %s : %s" % (key_path, to_native(e))) - # extract individual keys into an array, skipping blank lines and comments new_keys = [s for s in key.splitlines() if s and not s.startswith('#')] diff --git a/tests/integration/targets/authorized_key/defaults/main.yml b/tests/integration/targets/authorized_key/defaults/main.yml index 7ec99ca..1b60f8c 100644 --- a/tests/integration/targets/authorized_key/defaults/main.yml +++ b/tests/integration/targets/authorized_key/defaults/main.yml @@ -35,5 +35,3 @@ multiple_keys_comments: | ssh-rsa DATA_BASIC 1@testing # I like adding comments yo-dude-this-is-not-a-key INVALID_DATA 2@testing ecdsa-sha2-nistp521 ECDSA_DATA 4@testing - -key_path: /tmp/id_rsa.pub diff --git a/tests/integration/targets/authorized_key/tasks/check_path.yml b/tests/integration/targets/authorized_key/tasks/check_path.yml deleted file mode 100644 index df5d46e..0000000 --- a/tests/integration/targets/authorized_key/tasks/check_path.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Create key file for test - ansible.builtin.copy: - dest: "{{ key_path }}" - content: "{{ rsa_key_basic }}" - mode: "0600" - -- name: Add key using path - ansible.posix.authorized_key: - user: root - key: file://{{ key_path }} - state: present - path: "{{ output_dir | expanduser }}/authorized_keys" - register: result - -- name: Assert that the key was added - ansible.builtin.assert: - that: - - result.changed == true - -- name: Add key using path again - ansible.posix.authorized_key: - user: root - key: file://{{ key_path }} - state: present - path: "{{ output_dir | expanduser }}/authorized_keys" - register: result - -- name: Assert that no changes were applied - ansible.builtin.assert: - that: - - result.changed == false diff --git a/tests/integration/targets/authorized_key/tasks/main.yml b/tests/integration/targets/authorized_key/tasks/main.yml index d687f17..6a22838 100644 --- a/tests/integration/targets/authorized_key/tasks/main.yml +++ b/tests/integration/targets/authorized_key/tasks/main.yml @@ -31,6 +31,3 @@ - name: Test for the management of comments with key ansible.builtin.import_tasks: comments.yml - -- name: Test for specifying key as a path - ansible.builtin.import_tasks: check_path.yml From 9df5aac2a55661147d541a5778cf8fa6127e0b8f Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:36:53 +0900 Subject: [PATCH 39/42] Revert "Revert "Merge pull request #556 from Akasurde/i350"" This reverts commit cd43bd10bbf4401582ef2305dfc74286b9da05a2. --- .github/BOTMETA.yml | 1 - meta/runtime.yml | 8 +------ plugins/callback/skippy.py | 43 -------------------------------------- 3 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 plugins/callback/skippy.py diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml index 60ae92a..ba8b798 100644 --- a/.github/BOTMETA.yml +++ b/.github/BOTMETA.yml @@ -40,7 +40,6 @@ files: labels: debug $plugins/patch.py: labels: patch - $plugins/skippy.py: $plugins/synchronize.py: labels: synchronize $plugins/timer.py: diff --git a/meta/runtime.yml b/meta/runtime.yml index a96714c..1e85b01 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,8 +1,2 @@ --- -requires_ansible: ">=2.14.0" -plugin_routing: - callback: - skippy: - deprecation: - removal_date: "2022-06-01" - warning_text: See the plugin documentation for more details +requires_ansible: ">=2.15.0" diff --git a/plugins/callback/skippy.py b/plugins/callback/skippy.py deleted file mode 100644 index ced28af..0000000 --- a/plugins/callback/skippy.py +++ /dev/null @@ -1,43 +0,0 @@ -# (c) 2012-2014, Michael DeHaan -# (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -DOCUMENTATION = ''' - name: skippy - type: stdout - requirements: - - set as main display callback - short_description: Ansible screen output that ignores skipped status - deprecated: - why: The 'default' callback plugin now supports this functionality - removed_at_date: '2022-06-01' - alternative: "'default' callback plugin with 'display_skipped_hosts = no' option" - extends_documentation_fragment: - - default_callback - description: - - This callback does the same as the default except it does not output skipped host/task/item status -''' - -from ansible.plugins.callback.default import CallbackModule as CallbackModule_default - - -class CallbackModule(CallbackModule_default): - - ''' - This is the default callback interface, which simply prints messages - to stdout when new callback events are received. - ''' - - CALLBACK_VERSION = 2.0 - CALLBACK_TYPE = 'stdout' - CALLBACK_NAME = 'ansible.posix.skippy' - - def v2_runner_on_skipped(self, result): - pass - - def v2_runner_item_on_skipped(self, result): - pass From 57be05289c71e09b71d3007107976b019ad4367b Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:41:22 +0900 Subject: [PATCH 40/42] Revert "Revert "Merge pull request #387 from ansiblejunky/fix-callback-output"" This reverts commit 3a085b0b10e33395630733d4368d408fc781a48d. --- changelogs/fragments/387_callback_output_header.yml | 3 +++ plugins/callback/profile_roles.py | 5 ++++- plugins/callback/profile_tasks.py | 5 ++++- plugins/callback/timer.py | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/387_callback_output_header.yml diff --git a/changelogs/fragments/387_callback_output_header.yml b/changelogs/fragments/387_callback_output_header.yml new file mode 100644 index 0000000..5eb8573 --- /dev/null +++ b/changelogs/fragments/387_callback_output_header.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - callback plugins - Add recap information to timer, profile_roles and profile_tasks callback outputs (https://github.com/ansible-collections/ansible.posix/pull/387). diff --git a/plugins/callback/profile_roles.py b/plugins/callback/profile_roles.py index 59a437f..270a74f 100644 --- a/plugins/callback/profile_roles.py +++ b/plugins/callback/profile_roles.py @@ -128,7 +128,10 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("ROLES RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/profile_tasks.py b/plugins/callback/profile_tasks.py index 5fb7972..c5cc5fe 100644 --- a/plugins/callback/profile_tasks.py +++ b/plugins/callback/profile_tasks.py @@ -193,7 +193,10 @@ class CallbackModule(CallbackBase): self._display_tasktime() def playbook_on_stats(self, stats): - self._display_tasktime() + # Align summary report header with other callback plugin summary + self._display.banner("TASKS RECAP") + + self._display.display(tasktime()) self._display.display(filled("", fchar="=")) timestamp(self) diff --git a/plugins/callback/timer.py b/plugins/callback/timer.py index 3ef9255..e2eca05 100644 --- a/plugins/callback/timer.py +++ b/plugins/callback/timer.py @@ -46,4 +46,6 @@ class CallbackModule(CallbackBase): def v2_playbook_on_stats(self, stats): end_time = datetime.utcnow() runtime = end_time - self.start_time - self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds" % (self.days_hours_minutes_seconds(runtime))) + # Align summary report header with other callback plugin summary + self._display.banner("PLAYBOOK RECAP") + self._display.display("Playbook run took %s days, %s hours, %s minutes, %s seconds\n\r" % (self.days_hours_minutes_seconds(runtime))) From 906bbb88b7388618c6736e40120795eb47352af2 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 9 Oct 2024 15:41:37 +0900 Subject: [PATCH 41/42] Revert "Revert "Merge pull request #568 from abakanovskii/feature/add_path_option_authorized_key"" This reverts commit 098b5bee701554b0b533eb0d2ef8fca45b8ee456. --- .../fragments/568_update_authorized_key.yml | 3 ++ plugins/modules/authorized_key.py | 23 ++++++++++++- .../targets/authorized_key/defaults/main.yml | 2 ++ .../authorized_key/tasks/check_path.yml | 32 +++++++++++++++++++ .../targets/authorized_key/tasks/main.yml | 3 ++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/568_update_authorized_key.yml create mode 100644 tests/integration/targets/authorized_key/tasks/check_path.yml diff --git a/changelogs/fragments/568_update_authorized_key.yml b/changelogs/fragments/568_update_authorized_key.yml new file mode 100644 index 0000000..7efa29c --- /dev/null +++ b/changelogs/fragments/568_update_authorized_key.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - authorized_keys - allow using absolute path to a file as a SSH key(s) source (https://github.com/ansible-collections/ansible.posix/pull/568) diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 9fbc610..1d68b4e 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -24,6 +24,7 @@ options: key: description: - The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys). + - You can also use V(file://) prefix to search remote for a file with SSH key(s). type: str required: true path: @@ -96,6 +97,12 @@ EXAMPLES = r''' state: present key: https://github.com/charlie.keys +- name: Set authorized keys taken from path on controller node + ansible.posix.authorized_key: + user: charlie + state: present + key: file:///home/charlie/.ssh/id_rsa.pub + - name: Set authorized keys taken from url using lookup ansible.posix.authorized_key: user: charlie @@ -223,6 +230,7 @@ from operator import itemgetter from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url +from ansible.module_utils.six.moves.urllib.parse import urlparse class keydict(dict): @@ -556,7 +564,7 @@ def enforce_state(module, params): follow = params.get('follow', False) error_msg = "Error getting key from: %s" - # if the key is a url, request it and use it as key source + # if the key is a url or file, request it and use it as key source if key.startswith("http"): try: resp, info = fetch_url(module, key) @@ -570,6 +578,19 @@ def enforce_state(module, params): # resp.read gives bytes on python3, convert to native string type key = to_native(key, errors='surrogate_or_strict') + if key.startswith("file"): + # if the key is an absolute path, check for existense and use it as a key source + key_path = urlparse(key).path + if not os.path.exists(key_path): + module.fail_json(msg="Path to a key file not found: %s" % key_path) + if not os.path.isfile(key_path): + module.fail_json(msg="Path to a key is a directory and must be a file: %s" % key_path) + try: + with open(key_path, 'r') as source_fh: + key = source_fh.read() + except OSError as e: + module.fail_json(msg="Failed to read key file %s : %s" % (key_path, to_native(e))) + # extract individual keys into an array, skipping blank lines and comments new_keys = [s for s in key.splitlines() if s and not s.startswith('#')] diff --git a/tests/integration/targets/authorized_key/defaults/main.yml b/tests/integration/targets/authorized_key/defaults/main.yml index 1b60f8c..7ec99ca 100644 --- a/tests/integration/targets/authorized_key/defaults/main.yml +++ b/tests/integration/targets/authorized_key/defaults/main.yml @@ -35,3 +35,5 @@ multiple_keys_comments: | ssh-rsa DATA_BASIC 1@testing # I like adding comments yo-dude-this-is-not-a-key INVALID_DATA 2@testing ecdsa-sha2-nistp521 ECDSA_DATA 4@testing + +key_path: /tmp/id_rsa.pub diff --git a/tests/integration/targets/authorized_key/tasks/check_path.yml b/tests/integration/targets/authorized_key/tasks/check_path.yml new file mode 100644 index 0000000..df5d46e --- /dev/null +++ b/tests/integration/targets/authorized_key/tasks/check_path.yml @@ -0,0 +1,32 @@ +--- +- name: Create key file for test + ansible.builtin.copy: + dest: "{{ key_path }}" + content: "{{ rsa_key_basic }}" + mode: "0600" + +- name: Add key using path + ansible.posix.authorized_key: + user: root + key: file://{{ key_path }} + state: present + path: "{{ output_dir | expanduser }}/authorized_keys" + register: result + +- name: Assert that the key was added + ansible.builtin.assert: + that: + - result.changed == true + +- name: Add key using path again + ansible.posix.authorized_key: + user: root + key: file://{{ key_path }} + state: present + path: "{{ output_dir | expanduser }}/authorized_keys" + register: result + +- name: Assert that no changes were applied + ansible.builtin.assert: + that: + - result.changed == false diff --git a/tests/integration/targets/authorized_key/tasks/main.yml b/tests/integration/targets/authorized_key/tasks/main.yml index 6a22838..d687f17 100644 --- a/tests/integration/targets/authorized_key/tasks/main.yml +++ b/tests/integration/targets/authorized_key/tasks/main.yml @@ -31,3 +31,6 @@ - name: Test for the management of comments with key ansible.builtin.import_tasks: comments.yml + +- name: Test for specifying key as a path + ansible.builtin.import_tasks: check_path.yml From 4d928119de1ee5b7ff65218361e1f62ce460d2ab Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Fri, 11 Oct 2024 16:20:27 +0900 Subject: [PATCH 42/42] Bump version 2.0.0 for the next release * main branch Signed-off-by: Hideki Saito --- changelogs/fragments/576_bump_version_2.yml | 3 +++ galaxy.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/576_bump_version_2.yml diff --git a/changelogs/fragments/576_bump_version_2.yml b/changelogs/fragments/576_bump_version_2.yml new file mode 100644 index 0000000..a93dbf6 --- /dev/null +++ b/changelogs/fragments/576_bump_version_2.yml @@ -0,0 +1,3 @@ +--- +trivial: + - Bump ansible.posix version to 2.0.0. diff --git a/galaxy.yml b/galaxy.yml index 8565e64..01e619c 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: ansible name: posix -version: 1.6.1 +version: 2.0.0 readme: README.md authors: - Ansible (github.com/ansible)