I have a pretty easy playbook to connect to a Juniper switch and provide me
the show version output. All works when I place the username and password
into the playbook no problem. What I would prefer to do is set the username
and password in group_vars/all and have the username and password read from
there. Any tips? I can't seem to get this going. I think I may need to pass
along a hostvars but can't seem to figure it out.
playbook:
- hosts: juniper
gather_facts: no
connection: local
tasks:
- name: DEFINE PROVIDER
set_fact:
hostinfo:
host: "{{ inventory_hostname }}"
password: xxxxx
username: admin
- debug: var=hostvars[inventory_hostname]
- name: show command
junos_command:
provider: "{{ hostinfo }}"
commands:
- show version
register: version
- debug: msg="{{ version.stdout }}"
group_vars/all
username=admin
password=xxxxxx
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/4d926cbc-3559-4a5a-b41c-7631c463af4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.