mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 15:45:20 +01:00
Compare commits
1 commit
fad023eea0
...
348b2fcb0b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
348b2fcb0b |
15 changed files with 154 additions and 132 deletions
|
|
@ -203,10 +203,8 @@ stages:
|
|||
targets:
|
||||
- name: RHEL 9.4
|
||||
test: rhel/9.4
|
||||
- name: FreeBSD 14.1
|
||||
test: freebsd/14.1
|
||||
- name: FreeBSD 13.4
|
||||
test: freebsd/13.4
|
||||
- name: FreeBSD 13.3
|
||||
test: freebsd/13.3
|
||||
- stage: Remote_2_18
|
||||
displayName: Remote devel
|
||||
dependsOn: []
|
||||
|
|
@ -281,7 +279,7 @@ stages:
|
|||
- 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
|
||||
|
|
|
|||
134
README.md
134
README.md
|
|
@ -4,6 +4,9 @@
|
|||
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)-->
|
||||
|
||||
<!-- 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:
|
||||
|
|
@ -11,72 +14,65 @@ https://dev.azure.com/ansible/ansible.posix/_apis/build/status/CI?branchName=mai
|
|||
* [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.
|
||||
|
||||
## Description
|
||||
|
||||
<!-- 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.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python:
|
||||
* The Python interpreter version must meet Ansible Core's requirements.
|
||||
* Ansible Core:
|
||||
- ansible-core 2.15 or later
|
||||
|
||||
## Installation
|
||||
|
||||
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:
|
||||
|
||||
|
||||
```yaml
|
||||
collections:
|
||||
- name: ansible.posix
|
||||
```
|
||||
|
||||
Note that if you install any collections from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package.
|
||||
To upgrade the collection to the latest available version, run the following command:
|
||||
|
||||
```shell
|
||||
ansible-galaxy collection install ansible.posix --upgrade
|
||||
```
|
||||
|
||||
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 1.0.0:
|
||||
|
||||
```shell
|
||||
ansible-galaxy collection install ansible.posix:==1.0.0
|
||||
```
|
||||
|
||||
See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details.
|
||||
|
||||
* 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).
|
||||
|
||||
## Use Cases
|
||||
## Supported Versions of Ansible
|
||||
<!--start requires_ansible-->
|
||||
## Ansible version compatibility
|
||||
|
||||
You can see the general use-cases as an example by `ansible-doc` command like below.
|
||||
This collection has been tested against following Ansible versions: **>=2.15**.
|
||||
<!--end requires_ansible-->
|
||||
|
||||
For example, ansible.posix.firewalld module:
|
||||
```shell
|
||||
ansible-doc ansible.posix.firewalld
|
||||
## 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.
|
||||
|
||||
## Installing this collection
|
||||
|
||||
You can install the ``ansible.posix`` collection with the Ansible Galaxy CLI:
|
||||
|
||||
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:
|
||||
|
||||
```yaml
|
||||
---
|
||||
collections:
|
||||
- name: ansible.posix
|
||||
```
|
||||
|
||||
Also, if you want to confirm the plugins descriptions, you can follow the following option with `ansible-doc` command:
|
||||
## Using this collection
|
||||
|
||||
For example, ansible.posix.profile_tasks callback plugin:
|
||||
```shell
|
||||
ansible-doc -t callback ansible.posix.profile_tasks
|
||||
```
|
||||
<!--Include some quick examples that cover the most common use cases for your collection content. -->
|
||||
|
||||
## Testing
|
||||
See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.
|
||||
|
||||
The following ansible-core versions have been tested with this collection:
|
||||
## Contributing to this collection
|
||||
|
||||
<!--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). -->
|
||||
|
||||
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.
|
||||
|
||||
* [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)
|
||||
|
||||
### 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.
|
||||
|
||||
## Release notes
|
||||
See [changelog](https://github.com/ansible-collections/ansible.posix/blob/main/CHANGELOG.rst) for more details.
|
||||
|
||||
## External requirements
|
||||
|
||||
None
|
||||
|
||||
## Tested with Ansible
|
||||
|
||||
<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. -->
|
||||
|
||||
- ansible-core 2.19 (devel)
|
||||
- ansible-core 2.18 (stable) *
|
||||
|
|
@ -84,30 +80,22 @@ The following ansible-core versions have been tested with this collection:
|
|||
- ansible-core 2.16 (stable)
|
||||
- ansible-core 2.15 (stable)
|
||||
|
||||
## Contributing
|
||||
*Note: For ansible-core 2.18, CI only covers sanity tests and no integration tests will be run until the test environment is released.*
|
||||
|
||||
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.
|
||||
## Roadmap
|
||||
|
||||
* [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)
|
||||
<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. -->
|
||||
|
||||
## More information
|
||||
|
||||
## Support
|
||||
<!-- 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: -->
|
||||
|
||||
See [Communication](#Communication) section.
|
||||
- [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)
|
||||
|
||||
## 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
|
||||
## Licensing
|
||||
|
||||
GNU General Public License v3.0 or later.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
bugfixes:
|
||||
- mount - Handle ``boot`` option on Linux, NetBSD and OpenBSD correctly (https://github.com/ansible-collections/ansible.posix/issues/364).
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
trivial:
|
||||
- Bump ansible.posix version to 2.0.0.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
trivial:
|
||||
- selinux - conditions for selinux integration tests have been modified to be more accurate.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
breaking_changes:
|
||||
- firewalld - Changed the type of forward and masquerade options from str to bool (https://github.com/ansible-collections/ansible.posix/issues/582).
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
trivial:
|
||||
- README.md - update README to cover RH guidelines (https://github.com/ansible-collections/ansible.posix/issues/585).
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
trivial:
|
||||
- Enabled remote and docker integration tests for devel branch.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
trivial:
|
||||
- Replaced FreeBSD version 13.3 with 13.4 and 14.1 in CI for devel branch.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
namespace: ansible
|
||||
name: posix
|
||||
version: 2.0.0
|
||||
version: 1.6.1
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (github.com/ansible)
|
||||
|
|
|
|||
|
|
@ -112,13 +112,11 @@ 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.
|
||||
- Note that the option type is changed to bool in ansible.posix version 2.0.0 and later.
|
||||
type: bool
|
||||
type: str
|
||||
masquerade:
|
||||
description:
|
||||
- The masquerade setting you would like to enable/disable to/from zones within firewalld.
|
||||
- Note that the option type is changed to bool in ansible.posix version 2.0.0 and later.
|
||||
type: bool
|
||||
type: str
|
||||
offline:
|
||||
description:
|
||||
- Ignores O(immediate) if O(permanent=true) and firewalld is not running.
|
||||
|
|
@ -877,8 +875,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='bool'),
|
||||
masquerade=dict(type='bool'),
|
||||
forward=dict(type='str'),
|
||||
masquerade=dict(type='str'),
|
||||
offline=dict(type='bool', default=False),
|
||||
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
|
||||
),
|
||||
|
|
@ -1131,7 +1129,16 @@ def main():
|
|||
msgs = msgs + transaction_msgs
|
||||
|
||||
if forward is not None:
|
||||
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
|
||||
# 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=(),
|
||||
|
|
@ -1145,7 +1152,16 @@ def main():
|
|||
msgs = msgs + transaction_msgs
|
||||
|
||||
if masquerade is not None:
|
||||
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
|
||||
# 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'
|
||||
transaction = MasqueradeTransaction(
|
||||
module,
|
||||
action_args=(),
|
||||
|
|
|
|||
|
|
@ -850,8 +850,11 @@ def main():
|
|||
args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'noauto'.")
|
||||
elif not module.params['boot']:
|
||||
args['boot'] = 'no'
|
||||
opts.append('noauto')
|
||||
args['opts'] = ','.join(opts)
|
||||
if 'defaults' in opts:
|
||||
args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'defaults'.")
|
||||
else:
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -114,3 +114,60 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -472,25 +472,6 @@
|
|||
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 }}'
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- selinux_config_original | length == selinux_config_after | length
|
||||
- (selinux_config_after | select("search", "^SELINUX=disabled\s*$") | list | length) > 0
|
||||
- (selinux_config_after | select("search", "^SELINUXTYPE=targeted\s*$") | list | length) > 0
|
||||
- selinux_config_after[selinux_config_after.index('SELINUX=disabled')] is search("^SELINUX=\w+$")
|
||||
- selinux_config_after[selinux_config_after.index('SELINUXTYPE=targeted')] is search("^SELINUXTYPE=\w+$")
|
||||
|
||||
- name: TEST 1 | Disable SELinux again, with kernel arguments update
|
||||
ansible.posix.selinux:
|
||||
|
|
|
|||
Loading…
Reference in a new issue