Juniper Network Automation using Ansible Tower Network Credentials

264 views
Skip to first unread message

Lance Le Roux

unread,
Oct 28, 2016, 1:05:57 PM10/28/16
to Ansible Project
I am trying to use the network credentials in Ansible Tower however it doesn't seem to work. I am using variable ANSIBLE_NET_USERNAME and ANSIBLE_NET_PASSWORD however they don't exist when I run my template.


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

  tasks:
  - name: Retrieve information from devices running Junos OS
    junos_get_facts:  
      host={{ inventory_hostname }}
      port=22
      user={{ ANSIBLE_NET_USERNAME }}
      passwd={{ ANSIBLE_NET_PASSWORD }}
    register: junos

  - name: version
    debug: msg="{{ junos.facts.version }}"

Peter Sprygada

unread,
Oct 28, 2016, 1:53:51 PM10/28/16
to ansible...@googlegroups.com
You are using the Juniper modules distributed from Galaxy which are not compatible with Tower today.  The only modules that work with Tower credentials are the Junos modules in core.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1266659c-3d92-4ea3-85ca-5322bf4f0fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lance Le Roux

unread,
Nov 1, 2016, 6:01:55 PM11/1/16
to Ansible Project
That was the problem. I changed the module to junos_facts which was already included with Ansible Tower.

---
- name: Get Device Facts
  hosts: all
  roles:
  connection: local
  gather_facts: no

  tasks:
  - name: Retrieve information from devices running Junos OS
    junos_facts:
      host={{ inventory_hostname }}
      port={{ ansible_ssh_port }}
    register: junos


On Friday, October 28, 2016 at 1:53:51 PM UTC-4, Peter Sprygada wrote:
You are using the Juniper modules distributed from Galaxy which are not compatible with Tower today.  The only modules that work with Tower credentials are the Junos modules in core.
On Fri, Oct 28, 2016 at 1:00 PM, Lance Le Roux <wiresc...@gmail.com> wrote:
I am trying to use the network credentials in Ansible Tower however it doesn't seem to work. I am using variable ANSIBLE_NET_USERNAME and ANSIBLE_NET_PASSWORD however they don't exist when I run my template.


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

  tasks:
  - name: Retrieve information from devices running Junos OS
    junos_get_facts:  
      host={{ inventory_hostname }}
      port=22
      user={{ ANSIBLE_NET_USERNAME }}
      passwd={{ ANSIBLE_NET_PASSWORD }}
    register: junos

  - name: version
    debug: msg="{{ junos.facts.version }}"

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages