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. 
$ ansible-playbook vyos.yml
....
failed: [router1] (item=eth1) => {
    "failed": true, 
    "item": "eth1", 
    "msg": "unable to open shell. Please see: 
https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell";
, 
    "rc": 255
}
...



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


-- 
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/3796c9a9-beeb-4c4c-b525-62a55af4e7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to