Ansible 社区包中的 firewalld 模块和 Python3 绑定
我正在使用Python3运行Ansible Community Package 5.6,
# 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
以下剧本,
---
- hosts: localhost
tasks:
- name: Open ports
firewalld:
zone: "public"
port: "58080/tcp"
permanent: true
immediate: true
state: enabled
become: true
become_method: sudo
失败的错误
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)"
}
firewalld 默认情况下已经安装了模块或Ansible.posix Collection,
# 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
我注意到Ansible Python模块和收集位置(如上图所示)并不指向/usr/usr//usr/ local/lib/python3.8/site-ackages/ansible_collections,我们需要配置这两个位置吗?
此外,一个需要将ANSIBLE_PYTHON_INTERPRETER设置为Python3解释器路径并安装Python3绑定。到底在哪里下载并安装Python3绑定?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于您预计将AWX安装在Docker上,他没有Galaxy包来做到这一点:
1。转到主服务器
找到这样的SMT
2。连接到该码头图像
3。运行命令安装PKG
现在运行您的剧本
The problem is that you propably have awx installed on docker and he dont have that galaxy package do this :
1. go to main server
find smt like this
2. connect to that docker image
3. Run command to install pkg
Done now run your playbook