mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Compare commits
21 commits
348b2fcb0b
...
fad023eea0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fad023eea0 | ||
|
|
1b9ae1c77f | ||
|
|
ae95adcfdc | ||
|
|
c654bf0b4c | ||
|
|
04283b5993 | ||
|
|
b0097bd14c | ||
|
|
b991f4f9af | ||
|
|
5eacaba86d | ||
|
|
8b611775d6 | ||
|
|
9171b7fcf1 | ||
|
|
2f095566c7 | ||
|
|
daca208c0b | ||
|
|
4d928119de | ||
|
|
906bbb88b7 | ||
|
|
57be05289c | ||
|
|
9df5aac2a5 | ||
|
|
098b5bee70 | ||
|
|
3a085b0b10 | ||
|
|
cd43bd10bb | ||
|
|
9cf2d8cc48 | ||
|
|
2041e7f918 |
15 changed files with 117 additions and 139 deletions
|
|
@ -203,8 +203,10 @@ stages:
|
|||
targets:
|
||||
- name: RHEL 9.4
|
||||
test: rhel/9.4
|
||||
- name: FreeBSD 13.3
|
||||
test: freebsd/13.3
|
||||
- name: FreeBSD 14.1
|
||||
test: freebsd/14.1
|
||||
- name: FreeBSD 13.4
|
||||
test: freebsd/13.4
|
||||
- stage: Remote_2_18
|
||||
displayName: Remote devel
|
||||
dependsOn: []
|
||||
|
|
@ -279,7 +281,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
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://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
|
||||
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
|
||||
---
|
||||
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.
|
||||
|
||||
|
|
|
|||
3
changelogs/fragments/365-boot-linux.yml
Normal file
3
changelogs/fragments/365-boot-linux.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- mount - Handle ``boot`` option on Linux, NetBSD and OpenBSD correctly (https://github.com/ansible-collections/ansible.posix/issues/364).
|
||||
3
changelogs/fragments/576_bump_version_2.yml
Normal file
3
changelogs/fragments/576_bump_version_2.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
trivial:
|
||||
- Bump ansible.posix version to 2.0.0.
|
||||
3
changelogs/fragments/581_ci_selinux.yml
Normal file
3
changelogs/fragments/581_ci_selinux.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
trivial:
|
||||
- selinux - conditions for selinux integration tests have been modified to be more accurate.
|
||||
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.
|
||||
3
changelogs/fragments/593_replace_freebsd_version.yml
Normal file
3
changelogs/fragments/593_replace_freebsd_version.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
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: 1.6.1
|
||||
version: 2.0.0
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (github.com/ansible)
|
||||
|
|
|
|||
|
|
@ -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=(),
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 }}'
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- selinux_config_original | length == selinux_config_after | length
|
||||
- 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+$")
|
||||
- (selinux_config_after | select("search", "^SELINUX=disabled\s*$") | list | length) > 0
|
||||
- (selinux_config_after | select("search", "^SELINUXTYPE=targeted\s*$") | list | length) > 0
|
||||
|
||||
- name: TEST 1 | Disable SELinux again, with kernel arguments update
|
||||
ansible.posix.selinux:
|
||||
|
|
|
|||
Loading…
Reference in a new issue