Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible errors with "Missing required library \"pan-os-python\"." when paloaltonetworks.panos is used under Python 3.12 #586

Open
Ac0lyte opened this issue Oct 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Ac0lyte
Copy link

Ac0lyte commented Oct 4, 2024

Describe the bug

Ansible errors with "Missing required library "pan-os-python"." when paloaltonetworks.panos is used under Python 3.12 even when pan-os-python, pan-python, and xmltodict are installed

Expected behavior

Ansible tasks should run without errors

Current behavior

Ansible errors with "Missing required library "pan-os-python"."

Possible solution

This is happening because distutils was removed from Python 3.12
This is a work around for end users, not a good solution.
pip install setuptools

I suspect that the correct solution will be using a different packaging formula.

Steps to reproduce

  1. Set up the environment
    `python -m venv ansible_test

    . ansible_test/bin/activate
    pip install ansible
    pip install pan-os-python pan-python xmltodict

    ansible-galaxy collection install paloaltonetworks.panos'

  2. create the playbook
    `---

  • name: Gather system info
    hosts: "firewall"
    connection: local

    vars:
    device:
    ip_address: "{{ ip_address }}"
    username: "{{ username }}"
    password: "{{ password }}"

    collections:

    • paloaltonetworks.panos

    tasks:

    • name: Gather facts for device
      paloaltonetworks.panos.panos_facts:
      provider: "{{ device }}"

    • 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"
      `

  1. Execute!
    ansible-playbook -i inventory.ini get-system-info.yml

Context

I am trying to manage my PanOS device with Ansible using Python 3.12

Your Environment

  • Collection: paloaltonetworks.panos
  • Python: Python 3.12.1
  • Ansible: ansible [core 2.17.4]
  • PAN-OS Python Library & version: pan-os-python==1.12.1 pan-python==0.17.0

Workaround for end users

pip install setuptools

@Ac0lyte Ac0lyte added the bug Something isn't working label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant