Code Monkey home page Code Monkey logo

Comments (9)

ktbyers avatar ktbyers commented on August 27, 2024

@XioNoX Which version of napalm are you using here (not Ansible module, but napalm itself)?

from napalm-ansible.

XioNoX avatar XioNoX commented on August 27, 2024

$ pip show napalm
[...]
Version: 0.51.0

from napalm-ansible.

dbarrosop avatar dbarrosop commented on August 27, 2024

Are you using a virtual environment to run ansible?

from napalm-ansible.

XioNoX avatar XioNoX commented on August 27, 2024

Not that I'm aware of.

from napalm-ansible.

ktbyers avatar ktbyers commented on August 27, 2024

@XioNoX This works for me when I run it:

$ ansible-playbook napalm_ios.yml -i ./ansible-hosts --module-path ~/napalm-ansible/data_gathering/

PLAY [Test NAPALM on IOS] ***************************************************** 

GATHERING FACTS *************************************************************** 
ok: [pynet-rtr1]

TASK: [Get facts] ************************************************************* 
ok: [pynet-rtr1]

PLAY RECAP ******************************************************************** 
pynet-rtr1                 : ok=2    changed=0    unreachable=0    failed=0   

Can you post your playbook and relevant section of ansible hosts (scrubbed of any confidential info)?

Also what version of Netmiko are you using?

$ python
Python 2.7.10 (default, Dec  8 2015, 18:25:23) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import netmiko
>>> netmiko.__version__
'0.3.0'

from napalm-ansible.

XioNoX avatar XioNoX commented on August 27, 2024
$ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import netmiko
>>> netmiko.__version__
'0.3.0'

$ ls roles/napalm/library/
napalm_get_facts napalm_install_config

---                                                                                                               
- name: Cisco facts
  hosts: all 
  connection: local
  gather_facts: no
  roles:
    - napalm
  vars_prompt:
    - name: "user_password"
      prompt: "Device password"
      private: yes 
  tasks:
    - name: Checking SSH connectivity
      tags: push
      wait_for: host={{ inventory_hostname }} port=22  timeout=5
    - name: Get Cisco Facts
      napalm_get_facts:
         hostname={{ inventory_hostname }}
         username=xionox
         dev_os=ios
         password={{ user_password }}
      register: cisco
    - name: print all facts
      debug: msg="{{ cisco.ansible_facts }}" 

ansible-playbook -i networking-devices-cisco cisco_facts.yml --limit myhost -vvvv

Loaded callback default of type stdout, v2.0
1 plays in cisco_facts.yml
Device password:

PLAY [Cisco facts] *************************************************************

TASK [Checking SSH connectivity] ***********************************************
task path: /network-automation/cisco_facts.yml:13
ESTABLISH LOCAL CONNECTION FOR USER: xionox
myhost EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1455904969.47-166918409601240 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1455904969.47-166918409601240 )" )
myhost PUT /tmp/tmpoGfBh9 TO /home/xionox/.ansible/tmp/ansible-tmp-1455904969.47-166918409601240/wait_for
myhost EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/xionox/.ansible/tmp/ansible-tmp-1455904969.47-166918409601240/wait_for; rm -rf "/home/xionox/.ansible/tmp/ansible-tmp-1455904969.47-166918409601240/" > /dev/null 2>&1
ok: [myhost] => {"changed": false, "elapsed": 0, "invocation": {"module_args": {"connect_timeout": 5, "delay": 0, "exclude_hosts": null, "host": "myhost", "path": null, "port": "22", "search_regex": null, "state": "started", "timeout": "5"}, "module_name": "wait_for"}, "path": null, "port": 22, "search_regex": null, "state": "started"}

TASK [Get Cisco Facts] *********************************************************
task path: /network-automation/cisco_facts.yml:16
ESTABLISH LOCAL CONNECTION FOR USER: xionox
myhost EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1455904969.7-141120962226216 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1455904969.7-141120962226216 )" )
myhost PUT /tmp/tmpg2hEfA TO /home/xionox/.ansible/tmp/ansible-tmp-1455904969.7-141120962226216/napalm_get_facts
myhost EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/env python /home/xionox/.ansible/tmp/ansible-tmp-1455904969.7-141120962226216/napalm_get_facts; rm -rf "/home/xionox/.ansible/tmp/ansible-tmp-1455904969.7-141120962226216/" > /dev/null 2>&1

Then it hangs there.
The fix (or workaround) from comment 0 fixes that.

from napalm-ansible.

ktbyers avatar ktbyers commented on August 27, 2024

@XioNoX Yes, I saw your fix, but that change shouldn't be necessary. I also wasn't able to reproduce your problem.

Can you reformat your playbook (YAML file) above. It got munched by the markdown.

from napalm-ansible.

XioNoX avatar XioNoX commented on August 27, 2024

Updated.

from napalm-ansible.

XioNoX avatar XioNoX commented on August 27, 2024

I'm not having this issue after pulling the latest version of napalm_get_facts.

from napalm-ansible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.