Code: Select all
{“changed”: false, “msg”: “Missing required library
\\”pan-os-python\\“.”, 'pypi': “https://pypi.org/project/pan-os-python%E2%80%9D,
'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’\]}
Code: Select all
pip list | grep pan
pan-os-python 1.8.0
pan-python 0.17.0
panos-upgrade-assurance 0.3.0
< /code>
Im Spielbuch beziehe ich mich auch auf den Python -Interpreter der virtuellen Umgebung: < /p>
vars:
ansible_python_interpreter: /home/user/Test/.venvTest/bin/python3.12
Das Spielbuch wurde normal über die CLI ausgeführt:
Code: Select all
ansible-playbook /home/user/Test/FirewallManagement/panos/get.system.info/panos.get.system.info.yml
< /code>
Das Skript sollte grundlegende Informationen zu einer Firewall zurückgeben, fehlschlägt jedoch aufgrund des nicht gefundenen Pakets < /p>
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"