Commit graph

92 commits

Author SHA1 Message Date
Zhanibek Adilbekov
c4ff0545f1
Firewalld: Add functionality to set source_port 2025-08-01 14:21:01 +05:00
saito-hideki
18e023dd77
Update AZP matrix to follow ansible-test changes
* https://github.com/ansible/ansible/pull/85558
* https://github.com/ansible/ansible/pull/85561
* https://github.com/ansible/ansible/pull/85562

Signed-off-by: saito-hideki <saito@fgrep.org>
2025-07-28 14:59:14 +09:00
saito-hideki
f977bffff2
[AZP] Add RHEL10 environment to CI matrix
* Fixes #642

Signed-off-by: saito-hideki <saito@fgrep.org>
2025-06-09 18:43:43 +09:00
Hideki Saito
7b9b1f4957
Fixes issue related to updating the ansible-core devel branch
* Fixes incorrect load path for json module in cgroup_perf_recap
* Remove unnecessary condition from seboolean integration tests
* Optimize conditions for selinux integration tests
* Fixes #630

Signed-off-by: Hideki Saito <saito@fgrep.org>
2025-04-17 00:11:31 +00:00
Abhijeet Kasurde
eead50b287
Apply suggestions from code review 2025-03-26 12:36:08 -07:00
Simon Leary
4ff0e3aa13 remove assertion of changed 2025-03-26 15:20:42 -04:00
Simon Leary
979f00ce75 fix lint errors 2025-03-26 15:18:35 -04:00
Simon Leary
7d8da00f79 add (check mode) to task name 2025-03-06 10:46:57 -05:00
Simon Leary
f087d58cbe fix bugs 2025-03-05 00:39:46 +00:00
Simon Leary
eb740e97d4 add check mode tests, add comments 2025-03-05 00:33:11 +00:00
Hideki Saito
6175a5028b
Change type of icmp_block_inversion option from str to bool
* Fixes #586

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-11-28 14:19:20 +09: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
Hideki Saito
2f095566c7
Modify conditions for selinux integratuion tests
Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-10-15 17:15:51 +09:00
copyrights
2041e7f918
mount: remove boot exception if defaults in opts 2024-10-04 14:39:04 +09:00
Александр Бакановский
5f3f8514eb
Allow remote path for authorized_key 2024-09-30 09:40:03 +03:00
softwarefactory-project-zuul[bot]
d968ac441e
Merge pull request #563 from dtvillafana/main
(feat) add no_log option for 'opts' parameter

SUMMARY

Allows you to set no_log on just the opts parameter.
This is useful for CIFS/SMB mounts that would otherwise leak secrets.

Adds feature from issue: . #497
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

mount

Reviewed-by: Hideki Saito <saito@fgrep.org>
2024-09-11 02:27:00 +00:00
dvillafana
e00a4299c1
(feat) add no_log options for 'opts' parameter
* Fixed #497
2024-09-11 11:04:16 +09:00
Gerlof Fokkema
257392f33d
Firewalld: Add functionality to set forwarding. Fixes #529. 2024-09-09 15:13:12 +09:00
Jill Rouleau
83c4d2abd1 lint fixes 2024-05-09 12:10:44 -07:00
Jill Rouleau
e5733c5e49 Quote string in test assertion 2024-05-07 16:53:57 -07:00
Jill Rouleau
d49bd27fae Revert "sysctl: Fixed sysctl to work on symlinks(#111)"
This reverts commit 34b467719e.
2024-05-07 16:53:57 -07:00
satken2
9064ff7eb2 sysctl: Fixed sysctl to work on symlinks(#111) 2024-05-07 16:53:57 -07:00
satken2
a842e5f96a sysctl: Fixed sysctl to work on symlinks(#111) 2024-05-07 16:53:57 -07:00
satken2
97dcdee670 sysctl: Fixed sysctl to work on symlinks(#111) 2024-05-07 16:53:57 -07:00
satken2
55ea4ba1de sysctl: Fixed sysctl to work on symlinks(#111) 2024-05-07 16:53:57 -07:00
Hideki Saito
4f93234a8b Replaced old selogin FQCN
- FCQN has been changed since comunity.general stable-6

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-03-26 10:39:34 +09:00
softwarefactory-project-zuul[bot]
2c52f969e1
Merge pull request #484 from flowerysong/firewalld_offline
firewalld: make offline do something

SUMMARY

ansible.posix.firewalld has an offline flag, but it currently does not do anything. What most people expect it to do is allow the task to proceed even when firewalld is offline, so it makes the most sense for it to override the immediate flag and prevent the module from throwing an error in that case.
Fixes #81.
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

firewalld
ADDITIONAL INFORMATION

Reviewed-by: Adam Miller <admiller@redhat.com>
2023-12-07 21:18:29 +00:00
Adam Miller
a85f736f6a refactor to comply with current ansible-lint and sanity guidelines
Signed-off-by: Adam Miller <admiller@redhat.com>
2023-12-06 17:22:59 -06:00
softwarefactory-project-zuul[bot]
6f95c8b356
Merge pull request #460 from gotmax23/respawn
Respawn modules to use the system python interpreter

SUMMARY
The seboolean, selinux, firewalld, and firewalld_info modules depend on
system bindings that are only available for the default system python
interpreter. ansible-core is not packaged for the default system python
interpreter on RHEL 8 and 9. When automatic interpreter discovery does
not occur (e.g. when using implicit localhost [1]), ansible-core will
not use the system interpreter to run ansible modules and the
aforementioned modules will not work even if the bindings are installed.
The RHEL ansible-core maintainers as well as the EPEL ansible and
ansible-collection-* package maintainers (inc. me) have gotten multiple
bug reports about this. We have been telling people to fix their setup
to use the correct Python interpreter. Fortunately, ansible-core 2.11
and above have a module utility that'll respawn modules to use the
correct system interpreter.
[1] https://docs.ansible.com/ansible/latest/inventory/implicit_localhost.html
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
seboolean
selinux
firewalld
firewalld_info

Reviewed-by: Adam Miller <admiller@redhat.com>
2023-11-30 17:03:21 +00:00
Paul Arthur
695fa213b3 firewalld: make offline do something 2023-11-29 00:06:36 +00:00
Felix Fontein
622aef2aad Switch to Ansible Galaxy compatible requirements files for tests. 2023-05-26 08:14:28 +02:00
Felix Fontein
4106ec65f9 Replace 'include:' with 'include_tasks:'.
'include:' is removed for ansible-core 2.16.
2023-05-21 13:17:48 +02:00
Maxwell G
ad414c87b4
respawn firewalld module when selinux is missing 2023-05-14 05:44:47 +00:00
Adam Miller
07f1e11015 fix sysctl integration test failing on newer versions of core
Previously NoneType was allowable, now it fails to convert to a str
type.

Signed-off-by: Adam Miller <admiller@redhat.com>
2023-05-05 11:59:04 -05:00
Adam Miller
9d1f67042e
Merge branch 'main' into bugfix_masquerade_icmp_block_inversion 2023-04-12 17:09:22 -05:00
softwarefactory-project-zuul[bot]
cddfa80d84
Merge pull request #402 from gnfzdz/bugfix_offline_add_interface
Fix adding interface to zone when firewalld is offline

SUMMARY

Fixes issue #357
The existing implementation had several issues which have been resolved by this PR:

incorrectly assumed some zone always exists that contains the interface
incorrectly included the logic to add the interface to the target zone inside of the condition checking if the interface is already assigned to a different zone (and needs to be removed)
passed an invalid argument to the constructor for FirewallClientZoneSettings

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
ansible.posix.firewalld
ADDITIONAL INFORMATION


  - name: Add lo interface to trusted zone
    ansible.posix.firewalld:
      interface: lo
      zone: trusted
      permanent: Yes
      state: enabled


Before
TASK [firewalld : Add lo interface to trusted zone] ****************************
task path: /root/ansible_collections/ansible/posix/tests/output/.tmp/integration/firewalld-gpgqwc7n-ÅÑŚÌβŁÈ/tests/integration/targets/firewalld/tasks/interface_test_cases.yml:7
Using module file /root/ansible_collections/ansible/posix/plugins/modules/firewalld.py
Pipelining is enabled.
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c '/usr/bin/python3.10 && sleep 0'
The full traceback is:
  File "/tmp/ansible_ansible.posix.firewalld_payload_2vetziz9/ansible_ansible.posix.firewalld_payload.zip/ansible_collections/ansible/posix/plugins/module_utils/firewalld.py", line 112, in action_handler
    return action_func(*action_func_args)
  File "/tmp/ansible_ansible.posix.firewalld_payload_2vetziz9/ansible_ansible.posix.firewalld_payload.zip/ansible_collections/ansible/posix/plugins/modules/firewalld.py", line 481, in set_enabled_permanent
fatal: [testhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "icmp_block": null,
            "icmp_block_inversion": null,
            "immediate": false,
            "interface": "lo",
            "masquerade": null,
            "offline": null,
            "permanent": true,
            "port": null,
            "port_forward": null,
            "rich_rule": null,
            "service": null,
            "source": null,
            "state": "enabled",
            "target": null,
            "timeout": 0,
            "zone": "trusted"
        }
    },
    "msg": "ERROR: Exception caught: list index out of range Permanent operation"
}

After
TASK [firewalld : Add lo interface to trusted zone] ****************************
task path: /root/ansible_collections/ansible/posix/tests/output/.tmp/integration/firewalld-tr92i6e1-ÅÑŚÌβŁÈ/tests/integration/targets/firewalld/tasks/interface_test_cases.yml:7
Using module file /root/ansible_collections/ansible/posix/plugins/modules/firewalld.py
Pipelining is enabled.
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<testhost> EXEC /bin/sh -c '/usr/bin/python3.10 && sleep 0'
changed: [testhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "icmp_block": null,
            "icmp_block_inversion": null,
            "immediate": false,
            "interface": "lo",
            "masquerade": null,
            "offline": null,
            "permanent": true,
            "port": null,
            "port_forward": null,
            "rich_rule": null,
            "service": null,
            "source": null,
            "state": "enabled",
            "target": null,
            "timeout": 0,
            "zone": "trusted"
        }
    },
    "msg": "Permanent operation, Changed lo to zone trusted, (offline operation: only on-disk configs were altered)"
}

Reviewed-by: Adam Miller <admiller@redhat.com>
2023-04-12 16:59:23 +00:00
Robért S. Guhr
0d2ff1d2d8 added integrations tests for protocol parameter 2023-02-15 00:41:57 +01:00
Robért S. Guhr
b2f053a856 Adjust assert for firewalld source test permanent 2023-02-14 23:39:17 +01:00
Gregory Furlong
6695394af6 Update ZoneTransaction to support adding/removing zones when firewalld is offline.
Add integration test cases for adding/removing a custom zone with the firewalld module.
2023-01-17 13:29:18 -05:00
Hideki Saito
d6a997b37d Modify firewalld port test cases to avoid port duplication.
Signed-off-by: Hideki Saito <saito@fgrep.org>
2022-12-22 15:42:38 +09:00
Hideki Saito
bd9aa64a2b
Merge branch 'main' into ephemeral_state 2022-12-15 15:04:28 +09:00
Gregory Furlong
e97087e616 Update firewalld module to consider the value of the icmp_block_inversion parameter when determining if icmp_block_inversion should be enabled/disabled. 2022-12-14 11:07:53 -05:00
Gregory Furlong
e647e147a1 Update firewalld module to consider the value of the masquerade parameter when determining if masquerade should be enabled/disabled. 2022-12-14 10:50:15 -05:00
Gregory Furlong
4229db1bbe Fix issue where interfaces could not be added to a zone when firewalld is offline. Resolves issue #357. 2022-12-13 17:27:59 -05:00
Hideki Saito
abfe36c62f Fix to follow pylint check in ansible-test-sanity-docker-devel
Signed-off-by: Hideki Saito <saito@fgrep.org>
2022-09-12 10:30:01 +09:00
NdFeB
04089e80fb Add ephemeral state to mount fs without altering fstab 2022-06-03 08:46:21 +02:00
Hideki Saito
667ebef95c Refine the handling of exclusive options using mutually_exclusive
- Fixes #255

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-11-29 18:46:28 +09:00
Mike Wallis
d1be5519e6 Whitespaces in paths or current working directory path of playbook causes rsync to incorrectly chdir to current source dir,
Example :

cd "/home/a/ansible plays"

task:
  - synchronize:
      src: a
      dest: b

Results in the following error being thrown

fatal: [remote-host]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --rsync-path='sudo -u root rsync' --out-format='<<CHANGED>>%i %n%L' /home/a/ansible plays/deployments// remote-user@remote-host:/data/", "msg": "rsync: [sender] link_stat \"/home/a/ansible\" failed: No such file or directory (2)\nrsync: [sender] change_dir \"/home/a/ansible plays/plays/a/\" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]\n", "rc": 23}
2021-10-25 19:44:43 +01:00
Hideki Saito
8f58cbb41c Fix integration test error on ansible devel branch
- Remove centos6 platforms for integration tests on
  the ansible devel branch from the azure-pipelines.
- Add delegate_to to each task of integration test for
  synchronized module on devel branch
- Modify invalid parameter test to use key instead of name
  for sysctl module
- Replace lookup plugin to slurp module in integration tests
  for selinux module
- Add creating working directory task in integration tests
  for acl module

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-10-04 17:10:20 +09:00
Hideki Saito
5a2b3662cb mount - add a newline at the end of line in fstab
* Fixes #210

Signed-off-by: Hideki Saito <saito@fgrep.org>
2021-09-27 12:19:06 +09:00