I have a network module playbook that connect to vyos router and gathers some info.
---
- name: play
hosts: vyos
gather_facts: no
connection: local
tasks:
- name: vyos facts
vyos_facts:
gather_subset: "!config"
- name: vyos command.
vyos_command:
commands:
- show interfaces ethernet {{ item }}
- show version
with_items:
- eth0
- eth1
This is my hosts file:
[vyos]
router1
router2
[vyos:vars]
ansible_user=vyos
ansible_ssh_pass=password
When I run the playbook, I get all the info from vyos_facts and vyos_command show interface ethernet eth0
But when it comes to {{ eth1 }} it fails with this message.
It doesnt continue to the show version part at all.
However, if I define the username and password under vyos_command it succeeds...
---
- name: play
hosts: vyos
gather_facts: no
connection: local
tasks:
- name: vyos facts
vyos_facts:
gather_subset: "!config"
- name: vyos command.
vyos_command:
commands:
- show interfaces ethernet {{ item }}
- show version
username: vyos
password: password
with_items:
- eth0
- eth1
My version:
$ ansible --version
ansible 2.3.1.0