forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bp-2.9] firewalld: Ensure idempotency
Fixes: ansible-collections/ansible.posix#179 Signed-off-by: Abhijeet Kasurde <[email protected]>
- Loading branch information
Showing
4 changed files
with
66 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
bugfixes: | ||
- firewalld - ensure idempotency with firewalld 0.9.3 (https://github.com/ansible-collections/ansible.posix/issues/179). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 57 additions & 14 deletions
71
test/integration/targets/firewalld/tasks/port_test_cases.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,63 @@ | ||
# Test playbook for the firewalld module - port operations | ||
# (c) 2017, Adam Miller <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
# This file is part of Ansible | ||
# | ||
# Ansible is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Ansible is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. | ||
- name: firewalld port range test permanent enabled | ||
firewalld: | ||
port: 5500-6950/tcp | ||
permanent: true | ||
state: enabled | ||
register: result | ||
|
||
- name: assert firewalld port range test permanent enabled worked | ||
assert: | ||
that: | ||
- result is changed | ||
|
||
- name: firewalld port range test permanent enabled rerun (verify not changed) | ||
firewalld: | ||
port: 5500-6950/tcp | ||
permanent: true | ||
state: enabled | ||
register: result | ||
|
||
- name: assert firewalld port range test permanent enabled rerun worked (verify not changed) | ||
assert: | ||
that: | ||
- result is not changed | ||
|
||
- name: firewalld port test permanent enabled | ||
firewalld: | ||
port: 6900/tcp | ||
permanent: true | ||
state: enabled | ||
register: result | ||
|
||
- name: assert firewalld port test permanent enabled worked | ||
assert: | ||
that: | ||
- result is changed | ||
|
||
- name: firewalld port test permanent enabled | ||
firewalld: | ||
port: 6900/tcp | ||
permanent: true | ||
state: enabled | ||
register: result | ||
|
||
- name: assert firewalld port test permanent enabled worked | ||
assert: | ||
that: | ||
- result is not changed | ||
|
||
- name: firewalld port test disabled | ||
firewalld: | ||
port: "{{ item }}" | ||
permanent: true | ||
state: disabled | ||
loop: | ||
- 6900/tcp | ||
- 5500-6950/tcp | ||
|
||
- name: firewalld port test permanent enabled | ||
firewalld: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
# Test playbook for the firewalld module | ||
# (c) 2017, Adam Miller <[email protected]> | ||
|
||
# This file is part of Ansible | ||
# | ||
# Ansible is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Ansible is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
- name: Ensure /run/firewalld exists | ||
file: | ||
|
@@ -28,8 +14,6 @@ | |
|
||
# firewalld port operation test cases | ||
- include_tasks: port_test_cases.yml | ||
# Skipping on CentOS 8 due to https://github.com/ansible/ansible/issues/64750 | ||
when: not (ansible_facts.distribution == "CentOS" and ansible_distribution_major_version is version('8', '==')) | ||
|
||
# firewalld source operation test cases | ||
- import_tasks: source_test_cases.yml |