Problem with new Juniper.junos Ansible modules

605 views
Skip to first unread message

tomi

unread,
Jan 19, 2018, 6:23:31 AM1/19/18
to Junos Python EZ
Hi,

I'm trying to use juniper.junos modules and I got a message like:

 [WARNING]: Ignoring invalid attribute: commands

Script is as simple as it can be:

---
- name: Get Device Facts
  hosts: hosts
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos

  tasks:
    - name: Checking NETCONF connectivity
      wait_for: host={{ inventory_hostname }} port=830 timeout=5

    - name: Execute single show version command.
      juniper_junos_command:
      commands:
        - "show version"
      register: response

But the output I receive is:

tomi-v:~/ansible$ ansible-playbook --limit 'test-gw-01' playbooks/request_command.yml
 [WARNING]: Ignoring invalid attribute: commands


PLAY [Get Device Facts] ************************************************************************************************************************************************************************************************************************************************

TASK [Checking NETCONF connectivity] ***********************************************************************************************************************************************************************************************************************************
ok: [test-gw-01]

TASK [Execute single show version command.] ****************************************************************************************************************************************************************************************************************************
fatal: [test-gw-01]: FAILED! => {"changed": false, "msg": "missing required arguments: commands"}
    to retry, use: --limit @/home/tomi/ansible/playbooks/request_command.retry

PLAY RECAP *************************************************************************************************************************************************************************************************************************************************************
test-gw-01             : ok=1    changed=0    unreachable=0    failed=1  

As for ansible and python everything seems to be up to date:
tomi-v:~/ansible$ pip freeze | grep junos
junos-eznc==2.1.7
junos-netconify==1.0.2

tomi-v:~/ansible$ ansible --version
ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/tomi/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

Juniper.junos (2.0.1)

W would be greatefull for any ideas.

--
Tomi.


Nitin Kr (Automation)

unread,
Jan 19, 2018, 6:26:09 AM1/19/18
to tomi, Junos Python EZ

Hi,

 

Can you check if your indentation is in place? Commands need to be inside juniper_junos_command. Refer

http://junos-ansible-modules.readthedocs.io/en/2.0.1/juniper_junos_command.html#examples

 

    - name: Execute single show version command.
      juniper_junos_command:
      commands:
        - "show version"
      register: response

 

Thanks

Nitin Kr

--
You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
junos-python-...@googlegroups.com.
Visit this group at
https://groups.google.com/group/junos-python-ez.
To view this discussion on the web visit
https://groups.google.com/d/msgid/junos-python-ez/95e41ee7-de3c-4e26-a796-b68ebf225645%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Tomasz Misiak

unread,
Jan 19, 2018, 6:43:47 AM1/19/18
to Nitin Kr (Automation), Junos Python EZ
Hi,
Thanks:D

--
Tomi

W dniu 2018-01-19 o 12:26, Nitin Kr (Automation) pisze:
Reply all
Reply to author
Forward
0 new messages