'firewalld module in Ansible Community Package and Python3 bindings
I'm running Ansible Community Package 5.6 with Python3,
# ansible-playbook --version
ansible-playbook [core 2.12.4]
config file = /opt/work/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /usr/local/lib/python3.8/site-packages/ansible_collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.13 ...
jinja version = 3.1.1
libyaml = True
The following playbook,
---
- hosts: localhost
tasks:
- name: Open ports
firewalld:
zone: "public"
port: "58080/tcp"
permanent: true
immediate: true
state: enabled
become: true
become_method: sudo
failed with the error
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"icmp_block": null,
"icmp_block_inversion": null,
"immediate": true,
"interface": null,
"masquerade": null,
"offline": null,
"permanent": true,
"port": "58080/tcp",
"port_forward": null,
"rich_rule": null,
"service": null,
"source": null,
"state": "enabled",
"target": null,
"timeout": 0,
"zone": "public"
}
},
"msg": "Python Module not found: firewalld and its python module are required for this module, version 0.2.11 or newer required (0.3.9 or newer for offline operations)"
}
The firewalld module or the ansible.posix collection is already installed by default,
# ansible-galaxy collection list
# /usr/local/lib/python3.8/site-packages/ansible_collections
Collection Version
----------------------------- -------
amazon.aws 2.2.0
ansible.netcommon 2.6.1
ansible.posix 1.3.0
I noticed that the ansible python module and collection location (shown in the above --version) are not pointing to /usr/local/lib/python3.8/site-packages/ansible_collections, do we need to configure these two locations?
In addition, one of the notes explained that we need set ansible_python_interpreter to python3 interpreter path and install the python3 bindings. Exactly where to download and install the python3 bindings?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
