Jawad Khan:
Need resolution in this : fatal: [ubuntu]: FAILED! => {“changed”: false, “msg”: “absent and present state can only be used in zone level operations”}
Jawad Khan:
trying to use firewalld module on ansible
Alistair Mackay:
You probably haven’t specified a zone
which is required for absent/present.
Jawad Khan:
Hi Allistair thanks for getting back to me
Jawad Khan:
Please allow me to share playbook
Jawad Khan:
hosts: ubuntu
become: yes
tasks:
- name: add a firewall rule.
firewalld:
permanent: yes
zone: public
state: absent
immediate: yes
rich_rule: rule family="ipv4" source address="0.0.0.0/0" port protocol="tcp" port="1234" accept
Jawad Khan:
state: absent or present
Alistair Mackay:
You;re trying to combine the zone operation with another transaction which is illegal. See the 4th bullet point here https://docs.ansible.com/ansible/latest/collections/ansible/posix/firewalld_module.html#notes
Jawad Khan:
I just needed to change the state from present to enabled
Jawad Khan:
that’s great
Jawad Khan:
thans Alistair