Hi,
I'm trying to get a playbook to connect to a juniper switch and do a 'show
version'
I'm totally new to this and wanted to do this without the use of yaml files
for username and password.
This is the code for the playbook:
*---*
*- hosts: switches*
* gather_facts: no*
* connection: local*
* tasks:*
* - name: DEFINE PROVIDER*
* set_fact:*
* hostinfo:*
* host: "{{ inventory_hostname }}"*
* password: ***************
* username: root*
* - debug: var=hostvars[inventory_hostname]*
* - name: show command*
* junos_command:*
* provider: "{{ hostinfo }}"*
* commands:*
* - show version*
* register: version*
The host file contains only 1 ip address to the switch.
I get this error for task "show command"
*fatal: [172.18.10.25]: FAILED! => {"changed": false, "failed": true,
"invocation": {"module_args": {"commands": ["show version"], "host":
"172.18.10.25", "interval": 1, "password":
"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 22, "provider": null,
"retries": 10, "username": "root", "waitfor": null}, "module_name":
"junos_command"}, "msg": "failed to connecto to 172.18.10.25:22 - "}*
Is there something wrong with my code? I also tried specifying the
username/password inside the task, didnt work either.
I can SSH to the switch from my server if not using ansible.
Thanks!
Oscar Bengtsson
--
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/ec69eb29-19db-4eff-a17b-0c9513654c49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.