mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 15:45:20 +01:00
Ensure firewalld version is at least 0.9.0
This commit is contained in:
parent
11439a0e6b
commit
7e40959a47
1 changed files with 7 additions and 1 deletions
|
|
@ -109,6 +109,7 @@ options:
|
||||||
forward:
|
forward:
|
||||||
description:
|
description:
|
||||||
- Whether intra zone forwarding should be enabled/disabled for a zone in firewalld.
|
- Whether intra zone forwarding should be enabled/disabled for a zone in firewalld.
|
||||||
|
This parameter supports on python-firewall 0.9.0 or later.
|
||||||
type: bool
|
type: bool
|
||||||
offline:
|
offline:
|
||||||
description:
|
description:
|
||||||
|
|
@ -191,7 +192,7 @@ EXAMPLES = r'''
|
||||||
forward: yes
|
forward: yes
|
||||||
state: enabled
|
state: enabled
|
||||||
permanent: yes
|
permanent: yes
|
||||||
zone: dmz
|
zone: custom
|
||||||
|
|
||||||
- ansible.posix.firewalld:
|
- ansible.posix.firewalld:
|
||||||
zone: custom
|
zone: custom
|
||||||
|
|
@ -228,10 +229,12 @@ EXAMPLES = r'''
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible_collections.ansible.posix.plugins.module_utils.firewalld import FirewallTransaction, fw_offline
|
from ansible_collections.ansible.posix.plugins.module_utils.firewalld import FirewallTransaction, fw_offline
|
||||||
|
from ansible_collections.ansible.posix.plugins.module_utils.version import StrictVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from firewall.client import Rich_Rule
|
from firewall.client import Rich_Rule
|
||||||
from firewall.client import FirewallClientZoneSettings
|
from firewall.client import FirewallClientZoneSettings
|
||||||
|
from firewall.config import VERSION as FIREWALLD_VERSION
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# The import errors are handled via FirewallTransaction, don't need to
|
# The import errors are handled via FirewallTransaction, don't need to
|
||||||
# duplicate that here
|
# duplicate that here
|
||||||
|
|
@ -1051,6 +1054,9 @@ def main():
|
||||||
|
|
||||||
if forward is not None:
|
if forward is not None:
|
||||||
|
|
||||||
|
if StrictVersion(FIREWALLD_VERSION) < StrictVersion('0.9.0'):
|
||||||
|
module.fail_json(msg=f'Intra zone forwarding requires firewalld>=0.9.0. Current version is {FIREWALLD_VERSION}.')
|
||||||
|
|
||||||
transaction = ForwardTransaction(
|
transaction = ForwardTransaction(
|
||||||
module,
|
module,
|
||||||
action_args=(),
|
action_args=(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue