Compare commits

...

8 commits

Author SHA1 Message Date
David K.
7f885bca9c
Merge 3fe65ff1b1 into c654bf0b4c 2024-11-06 12:33:16 +09:00
softwarefactory-project-zuul[bot]
c654bf0b4c
Merge pull request #588 from saito-hideki/pr/enable_test_for_devel
[CI] enabled integration tests for devel branch

SUMMARY
Enabled integration tests for devel branch

Remote tests
Docker tests

ISSUE TYPE

CI tests Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None
2024-11-06 02:32:26 +00:00
Hideki Saito
04283b5993
[CI] enable integration tests for devel branch
* Remote tests
* Docker tests

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-11-06 11:07:13 +09:00
softwarefactory-project-zuul[bot]
b0097bd14c
Merge pull request #587 from saito-hideki/issue/587
Update README to cover RH guidelines

SUMMARY
This PR updates README.md to cover Red Hat guidelines
Also, this new content aligns with the community template content guidelines.

Fixes #585

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ansible.posix

ADDITIONAL INFORMATION
None

Reviewed-by: Adam Miller <admiller@redhat.com>
Reviewed-by: Andrew Klychkov <aklychko@redhat.com>
Reviewed-by: Hideki Saito <saito@fgrep.org>
2024-11-05 14:08:33 +00:00
Hideki Saito
b991f4f9af
Update README to cover RH guidelines
* Fixes #585

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-11-05 21:30:07 +09:00
softwarefactory-project-zuul[bot]
5eacaba86d
Merge pull request #584 from saito-hideki/issue/582
Changed the type of the forward and masquerade options from str to bool

SUMMARY
The forward and masquerade options for the firewall module takes either True or False as a value.
Currently, it is defined as a string, but it should be a boolean.

Fixes #582

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ansible.posix.firewalld

ADDITIONAL INFORMATION
None

Reviewed-by: Adam Miller <admiller@redhat.com>
Reviewed-by: Andrew Klychkov <aklychko@redhat.com>
2024-10-31 23:26:30 +00:00
Hideki Saito
8b611775d6
Changed the type of forward and masquerade options from str to bool
* Breaking Change
* Fixes #582

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-10-31 16:06:10 +09:00
David K
3fe65ff1b1 Add ansible_ssh_password as alias for ansible_ssh_pass variable
ssh connection reads password from variables ansible_password, ansible_ssh_pass and ansible_ssh_password. In synchronize ansible_ssh_password was missing.
2024-10-11 21:42:08 +02:00
8 changed files with 83 additions and 131 deletions

View file

@ -279,7 +279,7 @@ stages:
- Remote_2_18
- Docker_2_18
- Sanity_devel
# - Remote_devel # Wait for test environment release
# - Docker_devel # Wait for test environment release
- Remote_devel
- Docker_devel
jobs:
- template: templates/coverage.yml

104
README.md
View file

@ -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)
[![Run Status](https://api.shippable.com/projects/5e669aaf8b17a60007e4d18d/badge?branch=main)]() <!--[![Codecov](https://img.shields.io/codecov/c/github/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
* 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.
* [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
<!--start requires_ansible-->
## Ansible version compatibility
## Requirements
This collection has been tested against following Ansible versions: **>=2.15**.
<!--end requires_ansible-->
* Python:
* The Python interpreter version must meet Ansible Core's requirements.
* Ansible Core:
- ansible-core 2.15 or later
## Included content
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.
## Installation
## Installing this collection
You can install the ``ansible.posix`` collection with the Ansible Galaxy CLI:
Before using this collection, you need to install it with the Ansible Galaxy command-line tool:
```shell
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
---
collections:
- 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)
* [Pull Requests](https://github.com/ansible-collections/ansible.posix/pulls)
* [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html)
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
### Code of Conduct
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.
## Use Cases
## Release notes
See [changelog](https://github.com/ansible-collections/ansible.posix/blob/main/CHANGELOG.rst) for more details.
You can see the general use-cases as an example by `ansible-doc` command like below.
## 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.18 (stable) *
@ -80,22 +84,30 @@ None
- 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.*
## 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)
- [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)
See [Communication](#Communication) section.
## 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.

View 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).

View file

@ -0,0 +1,3 @@
---
trivial:
- README.md - update README to cover RH guidelines (https://github.com/ansible-collections/ansible.posix/issues/585).

View file

@ -0,0 +1,3 @@
---
trivial:
- Enabled remote and docker integration tests for devel branch.

View file

@ -342,7 +342,9 @@ class ActionModule(ActionBase):
# Determine if we need a user@ and a password
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:
# Src and dest rsync "path" handling
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)
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:
password = self._templar.template(password)
else:

View file

@ -112,11 +112,13 @@ options:
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
- Note that the option type is changed to bool in ansible.posix version 2.0.0 and later.
type: bool
masquerade:
description:
- 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:
description:
- 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']),
timeout=dict(type='int', default=0),
interface=dict(type='str'),
forward=dict(type='str'),
masquerade=dict(type='str'),
forward=dict(type='bool'),
masquerade=dict(type='bool'),
offline=dict(type='bool', default=False),
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
),
@ -1129,16 +1131,7 @@ def main():
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'
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
transaction = ForwardTransaction(
module,
action_args=(),
@ -1152,16 +1145,7 @@ def main():
msgs = msgs + transaction_msgs
if masquerade is not None:
# Type of masquerade will be changed to boolean in a future release.
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'
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
transaction = MasqueradeTransaction(
module,
action_args=(),

View file

@ -114,60 +114,3 @@
ansible.builtin.assert:
that:
- 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