mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 23:55:19 +01:00
Compare commits
8 commits
31afc536ad
...
7f885bca9c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f885bca9c | ||
|
|
c654bf0b4c | ||
|
|
04283b5993 | ||
|
|
b0097bd14c | ||
|
|
b991f4f9af | ||
|
|
5eacaba86d | ||
|
|
8b611775d6 | ||
|
|
3fe65ff1b1 |
8 changed files with 83 additions and 131 deletions
|
|
@ -279,7 +279,7 @@ stages:
|
||||||
- Remote_2_18
|
- Remote_2_18
|
||||||
- Docker_2_18
|
- Docker_2_18
|
||||||
- Sanity_devel
|
- Sanity_devel
|
||||||
# - Remote_devel # Wait for test environment release
|
- Remote_devel
|
||||||
# - Docker_devel # Wait for test environment release
|
- Docker_devel
|
||||||
jobs:
|
jobs:
|
||||||
- template: templates/coverage.yml
|
- template: templates/coverage.yml
|
||||||
|
|
|
||||||
104
README.md
104
README.md
|
|
@ -4,9 +4,6 @@
|
||||||
https://dev.azure.com/ansible/ansible.posix/_apis/build/status/CI?branchName=main)](https://dev.azure.com/ansible/ansible.posix/_build?definitionId=26)
|
https://dev.azure.com/ansible/ansible.posix/_apis/build/status/CI?branchName=main)](https://dev.azure.com/ansible/ansible.posix/_build?definitionId=26)
|
||||||
[]() <!--[](https://codecov.io/gh/ansible-collections/ansible.posix)-->
|
[]() <!--[](https://codecov.io/gh/ansible-collections/ansible.posix)-->
|
||||||
|
|
||||||
<!-- Describe the collection and why a user would want to use it. What does the collection do? -->
|
|
||||||
An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and derivative Operating Systems.
|
|
||||||
|
|
||||||
## Communication
|
## Communication
|
||||||
|
|
||||||
* Join the Ansible forum:
|
* Join the Ansible forum:
|
||||||
|
|
@ -14,65 +11,72 @@ An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and de
|
||||||
* [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts.
|
* [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.
|
* [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.
|
## Description
|
||||||
|
|
||||||
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
|
<!-- Describe the collection and why a user would want to use it. What does the collection do? -->
|
||||||
|
An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and derivative Operating Systems.
|
||||||
|
|
||||||
## Supported Versions of Ansible
|
## Requirements
|
||||||
<!--start requires_ansible-->
|
|
||||||
## Ansible version compatibility
|
|
||||||
|
|
||||||
This collection has been tested against following Ansible versions: **>=2.15**.
|
* Python:
|
||||||
<!--end requires_ansible-->
|
* The Python interpreter version must meet Ansible Core's requirements.
|
||||||
|
* Ansible Core:
|
||||||
|
- ansible-core 2.15 or later
|
||||||
|
|
||||||
## Included content
|
## Installation
|
||||||
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
|
Before using this collection, you need to install it with the Ansible Galaxy command-line tool:
|
||||||
|
|
||||||
You can install the ``ansible.posix`` collection with the Ansible Galaxy CLI:
|
```shell
|
||||||
|
ansible-galaxy collection install ansible.posix
|
||||||
|
```
|
||||||
|
|
||||||
ansible-galaxy collection install ansible.posix
|
You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:
|
||||||
|
|
||||||
You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
|
||||||
collections:
|
collections:
|
||||||
- name: ansible.posix
|
- name: ansible.posix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using this collection
|
Note that if you install any collections from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package.
|
||||||
|
To upgrade the collection to the latest available version, run the following command:
|
||||||
|
|
||||||
<!--Include some quick examples that cover the most common use cases for your collection content. -->
|
```shell
|
||||||
|
ansible-galaxy collection install ansible.posix --upgrade
|
||||||
|
```
|
||||||
|
|
||||||
See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.
|
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 1.0.0:
|
||||||
|
|
||||||
## Contributing to this collection
|
```shell
|
||||||
|
ansible-galaxy collection install ansible.posix:==1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
<!--Describe how the community can contribute to your collection. At a minimum, include how and where users can create issues to report problems or request features for this collection. List contribution requirements, including preferred workflows and necessary testing, so you can benefit from community PRs. If you are following general Ansible contributor guidelines, you can link to - [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html). -->
|
See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details.
|
||||||
|
|
||||||
We welcome community contributions to this collection. See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details.
|
* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes.
|
||||||
|
|
||||||
* [Issues](https://github.com/ansible-collections/ansible.posix/issues)
|
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
|
||||||
* [Pull Requests](https://github.com/ansible-collections/ansible.posix/pulls)
|
|
||||||
* [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html)
|
|
||||||
|
|
||||||
### Code of Conduct
|
## Use Cases
|
||||||
This collection follows the Ansible project's
|
|
||||||
[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
|
|
||||||
Please read and familiarize yourself with this document.
|
|
||||||
|
|
||||||
## Release notes
|
You can see the general use-cases as an example by `ansible-doc` command like below.
|
||||||
See [changelog](https://github.com/ansible-collections/ansible.posix/blob/main/CHANGELOG.rst) for more details.
|
|
||||||
|
|
||||||
## External requirements
|
For example, ansible.posix.firewalld module:
|
||||||
|
```shell
|
||||||
|
ansible-doc ansible.posix.firewalld
|
||||||
|
```
|
||||||
|
|
||||||
None
|
Also, if you want to confirm the plugins descriptions, you can follow the following option with `ansible-doc` command:
|
||||||
|
|
||||||
## Tested with Ansible
|
For example, ansible.posix.profile_tasks callback plugin:
|
||||||
|
```shell
|
||||||
|
ansible-doc -t callback ansible.posix.profile_tasks
|
||||||
|
```
|
||||||
|
|
||||||
<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. -->
|
## Testing
|
||||||
|
|
||||||
|
The following ansible-core versions have been tested with this collection:
|
||||||
|
|
||||||
- ansible-core 2.19 (devel)
|
- ansible-core 2.19 (devel)
|
||||||
- ansible-core 2.18 (stable) *
|
- ansible-core 2.18 (stable) *
|
||||||
|
|
@ -80,22 +84,30 @@ None
|
||||||
- ansible-core 2.16 (stable)
|
- ansible-core 2.16 (stable)
|
||||||
- ansible-core 2.15 (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.*
|
## Contributing
|
||||||
|
|
||||||
## Roadmap
|
We welcome community contributions to this collection. For more details, see [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details.
|
||||||
|
|
||||||
<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. -->
|
* [Issues](https://github.com/ansible-collections/ansible.posix/issues)
|
||||||
|
* [Pull Requests](https://github.com/ansible-collections/ansible.posix/pulls)
|
||||||
|
* [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html)
|
||||||
|
|
||||||
## More information
|
|
||||||
|
|
||||||
<!-- List out where the user can find additional information, such as working group meeting times, slack/IRC channels, or documentation for the product this collection automates. At a minimum, link to: -->
|
## Support
|
||||||
|
|
||||||
- [Ansible Collection overview](https://github.com/ansible-collections/overview)
|
See [Communication](#Communication) section.
|
||||||
- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html)
|
|
||||||
- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html)
|
|
||||||
- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html)
|
|
||||||
|
|
||||||
## Licensing
|
## Release Notes and Roadmap
|
||||||
|
|
||||||
|
See [changelog](https://github.com/ansible-collections/ansible.posix/blob/main/CHANGELOG.rst) for more details.
|
||||||
|
|
||||||
|
## Related Information
|
||||||
|
|
||||||
|
This document was written using the following [template](https://access.redhat.com/articles/7068606).
|
||||||
|
|
||||||
|
The README has been carefully prepared to cover the [community template](https://github.com/ansible-collections/collection_template/blob/main/README.md), but if you find any problems, please file a [documentation issue](https://github.com/ansible-collections/ansible.posix/issues/new?assignees=&labels=&projects=&template=documentation_report.md).
|
||||||
|
|
||||||
|
## License Information
|
||||||
|
|
||||||
GNU General Public License v3.0 or later.
|
GNU General Public License v3.0 or later.
|
||||||
|
|
||||||
|
|
|
||||||
3
changelogs/fragments/584_firewalld_opt_type.yml
Normal file
3
changelogs/fragments/584_firewalld_opt_type.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
breaking_changes:
|
||||||
|
- firewalld - Changed the type of forward and masquerade options from str to bool (https://github.com/ansible-collections/ansible.posix/issues/582).
|
||||||
3
changelogs/fragments/587_update_README.yml
Normal file
3
changelogs/fragments/587_update_README.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- README.md - update README to cover RH guidelines (https://github.com/ansible-collections/ansible.posix/issues/585).
|
||||||
3
changelogs/fragments/588_ci_enable_devel.yml
Normal file
3
changelogs/fragments/588_ci_enable_devel.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- Enabled remote and docker integration tests for devel branch.
|
||||||
|
|
@ -342,7 +342,9 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
# Determine if we need a user@ and a password
|
# Determine if we need a user@ and a password
|
||||||
user = None
|
user = None
|
||||||
password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None)
|
password = (task_vars.get('ansible_ssh_password', None)
|
||||||
|
or task_vars.get('ansible_ssh_pass', None)
|
||||||
|
or task_vars.get('ansible_password', None))
|
||||||
if not dest_is_local:
|
if not dest_is_local:
|
||||||
# Src and dest rsync "path" handling
|
# Src and dest rsync "path" handling
|
||||||
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
||||||
|
|
@ -372,7 +374,9 @@ class ActionModule(ActionBase):
|
||||||
src = self._process_origin(src_host, src, user)
|
src = self._process_origin(src_host, src, user)
|
||||||
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
|
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
|
||||||
|
|
||||||
password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None)
|
password = (dest_host_inventory_vars.get('ansible_ssh_password', None)
|
||||||
|
or dest_host_inventory_vars.get('ansible_ssh_pass', None)
|
||||||
|
or dest_host_inventory_vars.get('ansible_password', None))
|
||||||
if self._templar is not None:
|
if self._templar is not None:
|
||||||
password = self._templar.template(password)
|
password = self._templar.template(password)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- The forward setting you would like to enable/disable to/from zones within firewalld.
|
- 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.
|
- This option only is supported by firewalld v0.9.0 or later.
|
||||||
type: str
|
- Note that the option type is changed to bool in ansible.posix version 2.0.0 and later.
|
||||||
|
type: bool
|
||||||
masquerade:
|
masquerade:
|
||||||
description:
|
description:
|
||||||
- The masquerade setting you would like to enable/disable to/from zones within firewalld.
|
- The masquerade setting you would like to enable/disable to/from zones within firewalld.
|
||||||
type: str
|
- Note that the option type is changed to bool in ansible.posix version 2.0.0 and later.
|
||||||
|
type: bool
|
||||||
offline:
|
offline:
|
||||||
description:
|
description:
|
||||||
- Ignores O(immediate) if O(permanent=true) and firewalld is not running.
|
- Ignores O(immediate) if O(permanent=true) and firewalld is not running.
|
||||||
|
|
@ -875,8 +877,8 @@ def main():
|
||||||
state=dict(type='str', required=True, choices=['absent', 'disabled', 'enabled', 'present']),
|
state=dict(type='str', required=True, choices=['absent', 'disabled', 'enabled', 'present']),
|
||||||
timeout=dict(type='int', default=0),
|
timeout=dict(type='int', default=0),
|
||||||
interface=dict(type='str'),
|
interface=dict(type='str'),
|
||||||
forward=dict(type='str'),
|
forward=dict(type='bool'),
|
||||||
masquerade=dict(type='str'),
|
masquerade=dict(type='bool'),
|
||||||
offline=dict(type='bool', default=False),
|
offline=dict(type='bool', default=False),
|
||||||
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
|
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
|
||||||
),
|
),
|
||||||
|
|
@ -1129,16 +1131,7 @@ def main():
|
||||||
msgs = msgs + transaction_msgs
|
msgs = msgs + transaction_msgs
|
||||||
|
|
||||||
if forward is not None:
|
if forward is not None:
|
||||||
# Type of forward will be changed to boolean in a future release.
|
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
|
||||||
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(
|
transaction = ForwardTransaction(
|
||||||
module,
|
module,
|
||||||
action_args=(),
|
action_args=(),
|
||||||
|
|
@ -1152,16 +1145,7 @@ def main():
|
||||||
msgs = msgs + transaction_msgs
|
msgs = msgs + transaction_msgs
|
||||||
|
|
||||||
if masquerade is not None:
|
if masquerade is not None:
|
||||||
# Type of masquerade will be changed to boolean in a future release.
|
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
|
||||||
masquerade_status = True
|
|
||||||
try:
|
|
||||||
masquerade_status = boolean(masquerade, True)
|
|
||||||
except TypeError:
|
|
||||||
module.warn('The value of the masquerade 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.' % masquerade)
|
|
||||||
|
|
||||||
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade_status else 'disabled'
|
|
||||||
transaction = MasqueradeTransaction(
|
transaction = MasqueradeTransaction(
|
||||||
module,
|
module,
|
||||||
action_args=(),
|
action_args=(),
|
||||||
|
|
|
||||||
|
|
@ -114,60 +114,3 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
|
|
||||||
# Validate backwards compatible behavior until masquerade is switched from string to boolean type
|
|
||||||
- name: Masquerade enabled when masquerade is non-boolean string and state is enabled
|
|
||||||
block:
|
|
||||||
- name: Testing enable masquerade
|
|
||||||
ansible.posix.firewalld:
|
|
||||||
zone: trusted
|
|
||||||
masquerade: some string
|
|
||||||
permanent: true
|
|
||||||
state: enabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Assert masquerade is enabled
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- result is changed
|
|
||||||
|
|
||||||
- name: Testing enable masquerade (verify not changed)
|
|
||||||
ansible.posix.firewalld:
|
|
||||||
zone: trusted
|
|
||||||
masquerade: some string
|
|
||||||
permanent: true
|
|
||||||
state: enabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Assert masquerade is enabled (verify not changed)
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- result is not changed
|
|
||||||
|
|
||||||
- name: Masquerade disabled when masquerade is non-boolean string and state is disabled
|
|
||||||
block:
|
|
||||||
- name: Testing disable masquerade
|
|
||||||
ansible.posix.firewalld:
|
|
||||||
zone: trusted
|
|
||||||
masquerade: some string
|
|
||||||
permanent: true
|
|
||||||
state: disabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Assert masquerade is disabled
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- result is changed
|
|
||||||
|
|
||||||
- name: Testing disable masquerade (verify not changed)
|
|
||||||
ansible.posix.firewalld:
|
|
||||||
zone: trusted
|
|
||||||
masquerade: some string
|
|
||||||
permanent: true
|
|
||||||
state: disabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Assert masquerade is disabled (verify not changed)
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- result is not changed
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue