fatal: [192.168.0.120]: FAILED! => {"changed": false, "msg": "Missing required library \"pandevice\"."}

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fatal: [192.168.0.120]: FAILED! => {"changed": false, "msg": "Missing required library \"pandevice\"."}

L0 Member

Hi

I'm using using ansible collections "paloaltonetworks.panos" and ended up with the below error.

TASK [retireve api-key]

fatal: [192.168.0.120]: FAILED! => {"changed": false, "msg": "Missing required library \"pandevice\"."}

 

I'm still wonder why its pointing to pandevice when I already installed pan-os-python. I thought pandevice is only for role- PaloAltoNetworks.paloaltonetworks. does pandevice required for collections as well? 

Its really confusing which modules will support which library( pan-python, pandevice, pan-os-python)

Playbook

---
  - hosts: palo

    gather_facts: true

    collections:
            - paloaltonetworks.panos

    tasks:
        - name: Grab Credentials
          include_vars: 'secrets.yml'
          no_log: 'yes'

        - name: retireve api-key
          panos_api_key:
               provider: '{{ palo_provider }}'
          register: auth
          any_errors_fatal: true

 

Can you someone help me?

3 REPLIES 3

L5 Sessionator

Hi @sridhar15, the below worked for me, taking your playbook as the groundwork.

There is a repo of example playbooks here which might help you: https://github.com/PaloAltoNetworks/ansible-playbooks
More details on pandevice -> pan-os-python here: https://github.com/PaloAltoNetworks/pan-os-python#upgrade-from-pandevice 

---
- hosts: '{{ target | default("firewall") }}'
  connection: local

  gather_facts: true

  collections:
            - paloaltonetworks.panos

  vars:
    palo_provider:
      ip_address: '{{ ip_address }}'
      username: '{{ username | default(omit) }}'
      password: '{{ password | default(omit) }}'
      api_key: '{{ api_key | default(omit) }}'

  tasks:
      - name: Grab Credentials
        include_vars: 'secrets.yml'
        no_log: 'yes'

      - name: retireve api-key
        panos_api_key:
              provider: '{{ palo_provider }}'
        register: auth
        any_errors_fatal: true

 

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

L5 Sessionator

The error message hasn't been updated to say "pan-os-python" yet, but it is indeed checking for the pan-os-python library first.

 

Since you say pan-os-python is installed but Ansible is not finding it, this likely means that you have multiple python environments setup (knowingly or unknowingly), and the python environment that Ansible is running in does not have pan-os-python installed.

L6 Presenter

As Gfreeman is saying if you run python --version what you see as the default version? You may installed "pan-os-python" under python2 or python3 (pip2 or pip3) but not under the default version of python.

 

https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/

 

https://dev.to/meetsohail/change-the-python3-default-version-in-ubuntu-1ekb

 

 

You can also create docker image and a container with ansible and the corect python than changing things and environmentals in your main operational system:


https://phoenixnap.com/kb/how-to-commit-changes-to-docker-image

  • 5149 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!