Code Monkey home page Code Monkey logo

Comments (5)

varnumd avatar varnumd commented on August 27, 2024

Do you know if this feature was ever introduced - or do you know a good work-around?

from napalm-ansible.

ktbyers avatar ktbyers commented on August 27, 2024

I think that is done.

Let me know if it doesn't work though.

from napalm-ansible.

varnumd avatar varnumd commented on August 27, 2024

Looks like I have the same error:

(ansible) [14:54:16] dvarnum:ansible-neteng git:(master*) $ ansible-playbook napalm_eos_testing.yml -l lab-campus-leaf3 -u dv -k                      
SSH password: 

PLAY [Get facts] *****************************************************************************************************************************************************************

TASK [get facts from device] *****************************************************************************************************************************************************
fatal: [lab-campus-leaf3]: FAILED! => {"changed": false, "msg": "username is required"}

PLAY RECAP ***********************************************************************************************************************************************************************
lab-campus-leaf3           : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Here's the playbook:

(ansible) [14:59:14] dvarnum:ansible-neteng git:(master*) $ cat napalm_eos_testing.yml
---
- name: Get facts
  hosts: eos
  connection: local
  gather_facts: no

  tasks:
    - name: get facts from device
      napalm_get_facts:
        hostname={{ inventory_hostname }}
        dev_os={{ ansible_network_os }}
        filter='facts,interfaces,bgp_neighbors'
      register: result    

    - name: print data
      debug: var=result

Am I missing something? Thanks for your time!

from napalm-ansible.

ktbyers avatar ktbyers commented on August 27, 2024

Hmmmm, I have to look into the username passing. I could have swore that worked, but I am seeing the same thing as you when I test it.

The -k passing works, but the -u username part is failing.

from napalm-ansible.

ktbyers avatar ktbyers commented on August 27, 2024

This fixes it...not sure why or when this changed though:

$ git diff ./napalm.py
diff --git a/napalm_ansible/plugins/action/napalm.py b/napalm_ansible/plugins/action/napalm.py
index ac37522..bbd70e0 100644
--- a/napalm_ansible/plugins/action/napalm.py
+++ b/napalm_ansible/plugins/action/napalm.py
@@ -13,7 +13,7 @@ class ActionModule(_ActionModule):
             provider = self._task.args.get('provider', {})
 
             provider['hostname'] = provider.get('hostname', provider.get('host', pc.remote_addr))
-            provider['username'] = provider.get('username', pc.connection_user)
+            provider['username'] = provider.get('username', pc.remote_user)
             provider['password'] = provider.get('password', pc.password)
             # Timeout can't be passed via command-line as Ansible defaults to a 10 second timeout
             provider['timeout'] = provider.get('timeout', 60)

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.