mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-13 16:15:21 +01:00
Compare commits
2 commits
330cec2caf
...
79f8dcc466
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f8dcc466 | ||
|
|
8b611775d6 |
2 changed files with 6 additions and 59 deletions
|
|
@ -112,11 +112,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- The forward setting you would like to enable/disable to/from zones within firewalld.
|
- 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.
|
- 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: bool
|
||||||
masquerade:
|
masquerade:
|
||||||
description:
|
description:
|
||||||
- The masquerade setting you would like to enable/disable to/from zones within firewalld.
|
- 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:
|
offline:
|
||||||
description:
|
description:
|
||||||
- Ignores O(immediate) if O(permanent=true) and firewalld is not running.
|
- Ignores O(immediate) if O(permanent=true) and firewalld is not running.
|
||||||
|
|
@ -876,7 +878,7 @@ def main():
|
||||||
timeout=dict(type='int', default=0),
|
timeout=dict(type='int', default=0),
|
||||||
interface=dict(type='str'),
|
interface=dict(type='str'),
|
||||||
forward=dict(type='bool'),
|
forward=dict(type='bool'),
|
||||||
masquerade=dict(type='str'),
|
masquerade=dict(type='bool'),
|
||||||
offline=dict(type='bool', default=False),
|
offline=dict(type='bool', default=False),
|
||||||
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
|
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
|
||||||
),
|
),
|
||||||
|
|
@ -1128,6 +1130,7 @@ def main():
|
||||||
changed, transaction_msgs = transaction.run()
|
changed, transaction_msgs = transaction.run()
|
||||||
msgs = msgs + transaction_msgs
|
msgs = msgs + transaction_msgs
|
||||||
|
|
||||||
|
if forward is not None:
|
||||||
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
|
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
|
||||||
transaction = ForwardTransaction(
|
transaction = ForwardTransaction(
|
||||||
module,
|
module,
|
||||||
|
|
@ -1141,6 +1144,7 @@ def main():
|
||||||
changed, transaction_msgs = transaction.run()
|
changed, transaction_msgs = transaction.run()
|
||||||
msgs = msgs + transaction_msgs
|
msgs = msgs + transaction_msgs
|
||||||
|
|
||||||
|
if masquerade is not None:
|
||||||
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
|
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
|
||||||
transaction = MasqueradeTransaction(
|
transaction = MasqueradeTransaction(
|
||||||
module,
|
module,
|
||||||
|
|
|
||||||
|
|
@ -114,60 +114,3 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- 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
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue