Juniper / jsnapy

Python version of Junos Snapshot Administrator
Apache License 2.0
116 stars 58 forks source link

"jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed." #334

Closed jas2061461 closed 5 years ago

jas2061461 commented 5 years ago

Description of Issue/Question

When I try to execute a playbook referencing the jsnapy module, I receive an error about the jsnapy installation. Other modules within juniper.junos Ansible library work fine e.g. juniper_junos_config, juniper_junos_rpc. Also, Jsnapy from the CLI and from a Python script work just fine. Not sure what's wrong.

Playbook

- name: Create and Push Configurations
  hosts: backbone
  roles:
    - Juniper.junos
  connection: local
  gather_facts: no

  tasks:
    - name: "Collect Pre Snapshot"
      juniper_junos_jsnapy:
        provider: "{{ credentials }}"
        action: "snap_pre"
        dir: "./tests"
        test_files: "isis.yaml"
      tags:
       - jsnapy

Output

TASK [Collect Pre Snapshot] ***************************************************************************************************************************************************************************************************
fatal: [d01-bbrj01]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d04-bbrj04]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d03-bbrj03]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d05-bprj01]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d02-bbrj02]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d06-bprj02]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d07-dsrj01]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d08-dsrj02]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d09-dsrj03]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
fatal: [d10-dsrj04]: FAILED! => {"changed": false, "msg": "jsnapy >= 1.2.1 is required for this module. However, jsnapy does not appear to be currently installed. See https://github.com/Juniper/jsnapy#installation for details on installing jsnapy."}
        to retry, use: --limit @/root/scripts/ansible/coloring/playbook.retry

Versions Report

root@ubuntu:~/scripts/jsnapy# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial
root@ubuntu:~/scripts/jsnapy# 
root@ubuntu:~/scripts/ansible/coloring# python --version
Python 2.7.12
root@ubuntu:~/scripts/ansible/coloring# python3 --version
Python 3.5.2
root@ubuntu:~# pip list | grep jsnap
jsnapy                  1.3.2   
root@ubuntu:~# ansible-galaxy --version
ansible-galaxy 2.7.8
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible-galaxy
  python version = 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609]

Juniper.junos Library Directory

root@ubuntu:~/.ansible/roles/Juniper.junos/library# ls -l
total 244
-rw-rw-r-- 1 root root 20282 Jun  1  2018 juniper_junos_command.py
-rw-rw-r-- 1 root root 47655 Jun  1  2018 juniper_junos_config.py
-rw-rw-r-- 1 root root 13148 Jun  1  2018 juniper_junos_facts.py
-rw-rw-r-- 1 root root 13677 Jun  1  2018 juniper_junos_jsnapy.py
-rw-rw-r-- 1 root root 17428 Jun  1  2018 juniper_junos_ping.py
-rw-rw-r-- 1 root root 15156 Jun  1  2018 juniper_junos_pmtud.py
-rw-rw-r-- 1 root root 24570 Jun  1  2018 juniper_junos_rpc.py
-rw-rw-r-- 1 root root 32448 Jun  1  2018 juniper_junos_software.py
-rw-rw-r-- 1 root root 10720 Jun  1  2018 juniper_junos_srx_cluster.py
-rw-rw-r-- 1 root root 18322 Jun  1  2018 juniper_junos_system.py
-rw-rw-r-- 1 root root 16396 Jun  1  2018 juniper_junos_table.py
lrwxrwxrwx 1 root root    24 Mar 26 17:02 _junos_cli.py -> juniper_junos_command.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_commit.py -> juniper_junos_config.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_get_config.py -> juniper_junos_config.py
lrwxrwxrwx 1 root root    22 Mar 26 17:02 _junos_get_facts.py -> juniper_junos_facts.py
lrwxrwxrwx 1 root root    22 Mar 26 17:02 _junos_get_table.py -> juniper_junos_table.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_install_config.py -> juniper_junos_config.py
lrwxrwxrwx 1 root root    25 Mar 26 17:02 _junos_install_os.py -> juniper_junos_software.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_jsnapy.py -> juniper_junos_jsnapy.py
lrwxrwxrwx 1 root root    21 Mar 26 17:02 _junos_ping.py -> juniper_junos_ping.py
lrwxrwxrwx 1 root root    22 Mar 26 17:02 _junos_pmtud.py -> juniper_junos_pmtud.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_rollback.py -> juniper_junos_config.py
lrwxrwxrwx 1 root root    20 Mar 26 17:02 _junos_rpc.py -> juniper_junos_rpc.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_shutdown.py -> juniper_junos_system.py
lrwxrwxrwx 1 root root    28 Mar 26 17:02 _junos_srx_cluster.py -> juniper_junos_srx_cluster.py
lrwxrwxrwx 1 root root    23 Mar 26 17:02 _junos_zeroize.py -> juniper_junos_system.py
root@ubuntu:~/.ansible/roles/Juniper.junos/library# 

Ansible Galaxy Info

root@ubuntu:~# ansible-galaxy info Juniper.junos

Role: Juniper.junos
        description: Network build automation of Junos devices.
        active: True
        commit: 019573cc435cd7c8c6eb54cce286cce1209d7b91
        commit_message: Merge pull request #372 from rsmekala/master

Prepare the 2.1.0 release
        commit_url: https://github.com/Juniper/ansible-junos-stdlib/commit/019573cc435cd7c8c6eb54cce286cce1209d7b91
        company: Juniper Networks, Inc.
        created: 2016-02-26T11:54:40.759806Z
        dependencies: []
        download_count: 116883
        forks_count: 117
        galaxy_info:
                author: Juniper
                categories: ['networking']
                company: Juniper Networks, Inc.
                galaxy_tags: ['networking', 'junos', 'juniper']
                license: Apache 2.0
                min_ansible_version: 2.1
                platforms: [{'name': 'junos', 'versions': ['all']}]
        github_branch: master
        github_repo: ansible-junos-stdlib
        github_user: Juniper
        id: 8138
        imported: 2018-06-01T05:42:42.847519-04:00
        install_date: Mon Apr  8 17:15:19 2019
        installed_version: 2.1.0
        is_valid: True
        issue_tracker_url: https://github.com/Juniper/ansible-junos-stdlib/issues
        license: Apache 2.0
        min_ansible_version: 2.1
        modified: 2018-06-30T05:11:19.035846Z
        open_issues_count: 26
        path: ['/root/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
        role_type: ANS
        stargazers_count: 197
        travis_status_url: 
root@ubuntu:~# 
jas2061461 commented 5 years ago

Resolved this by installing via these instructions instead of just "pip install jsnapy"

Step 1: Update package list

sudo apt-get update

Step 2: Install OS packages required by Junos JSNAPy and it's pre-requisite Python packages

sudo apt-get install -y --force-yes python-dev libxslt1-dev libssl-dev libffi-dev

Step 3: Install the pip package manager from source

wget https://bootstrap.pypa.io/get-pip.py -O - | sudo python

Step 4: Install Junos JSNAPy

sudo pip install git+https://github.com/Juniper/jsnapy.git