admin管理员组文章数量:1122826
When executing a playbook with the ansible collection paloaltonetworks.panos
I get the error message Missing required library
{“changed”: false, “msg”: “Missing required library
\\”pan-os-python\\“.”, 'pypi': “,
'syspath': \["/tmp/ansible_paloaltonetworks.panos. panos_facts_payload_ygajy97b/
ansible_paloaltonetworks.panos.panos_facts_payload.zip”,
‘/usr/lib/python312. zip’, ‘/usr/lib/python3.12’,
‘/usr/lib/python3.12/lib-dynload’,
‘/home/user/Test/.venvTest/lib/python3.12/site-packages’\]}
The required package pan-os-python
is installed in the virtual python environment according to pip list:
pip list | grep pan
pan-os-python 1.8.0
pan-python 0.17.0
panos-upgrade-assurance 0.3.0
In the playbook I also refer to the python interpreter of the virtual environment:
vars:
ansible_python_interpreter: /home/user/Test/.venvTest/bin/python3.12
The system used is a Linux ubuntu 22.04
The playbook was executed normally via the CLI:
ansible-playbook /home/user/Test/FirewallManagement/panos/get.system.info/panos.get.system.info.yml
The script should return basic information about a firewall but fails due to the package not being found
the playbook runs locally:
# ansible-playbook /home/user/Test/FirewallManagement/panos/get.system.info/panos.get.system.info.yml
---
- name: Gather system info
hosts: "{{ host }}"
connection: local
collections:
- paloaltonetworks.panos
vars:
ansible_python_interpreter: /home/user/Test/.venvTest/bin/python3.12
vars_prompt:
- name: host
prompt: Device/Devicegroup
private: no
tasks:
- name: Gather facts for device
paloaltonetworks.panos.panos_facts:
provider: "{{ provider }}"
- name: Display information
ansible.builtin.debug:
msg:
- "Hostname: {{ ansible_facts['net_hostname'] }}"
- "Serial: {{ ansible_facts['net_serial'] }}"
- "Model: {{ ansible_facts['net_model'] }}"
- "Version: {{ ansible_facts['net_version'] }}"
- "Uptime: {{ ansible_facts['net_uptime'] }}"
- "HA Enabled: {{ ansible_facts['net_ha_enabled'] }}"
- "HA Type: {{ ansible_facts['net_ha_localmode'] }}"
- "HA Status: {{ ansible_facts['net_ha_localstate'] }}"
- "Multi-VSYS: {{ ansible_facts['net_multivsys'] }}"
- "{{ ansible_facts['net_session_usage'] }} out of {{ ansible_facts['net_session_max'] }} sessions in use"
- name: Save to file
copy:
content:
- "{{ ansible_facts['net_hostname'] }}"
- "{{ ansible_facts['net_serial'] }}"
- "{{ ansible_facts['net_model'] }}"
- "{{ ansible_facts['net_version'] }}"
- "{{ ansible_facts['net_uptime'] }}"
- "{{ ansible_facts['net_ha_enabled'] }}"
- "{{ ansible_facts['net_ha_localmode'] }}"
- "{{ ansible_facts['net_ha_localstate'] }}"
- "{{ ansible_facts['net_multivsys'] }}"
dest: "/home/user/Test/FirewallManagement/panos/get.system.info/temp/{{ host }}.json"
本文标签: pythonAnsible Playbooks Missing required libraryStack Overflow
版权声明:本文标题:python - Ansible Playbooks: Missing required library - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300919a1930995.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论