am i impacted with some bug ?
"VARIABLE IS NOT DEFINED!"
root@eve-ng:/etc/ansible# ansible-playbook test.yaml
PLAY [collect device facts and display OS version] **********************************************************************************************************
TASK [run the show commands] ********************************************************************************************************************************
[WARNING]: argument username has been deprecated and will be removed in a future version
[WARNING]: argument host has been deprecated and will be removed in a future version
[WARNING]: argument password has been deprecated and will be removed in a future version
ok: [8.8.8.8]
ok: [5.5.5.5]
TASK [debug] ************************************************************************************************************************************************
ok: [8.8.8.8] => {
"version.stdout[0].Version": "VARIABLE IS NOT DEFINED!"
}
ok: [5.5.5.5] => {
"version.stdout[0].Version": "VARIABLE IS NOT DEFINED!"
}
PLAY RECAP **************************************************************************************************************************************************
5.5.5.5 : ok=2 changed=0 unreachable=0 failed=0
8.8.8.8 : ok=2 changed=0 unreachable=0 failed=0
root@eve-ng:/etc/ansible# more test.yaml
---
- name: collect device facts and display OS version
hosts: "{{ inventory | default('all') }}"
gather_facts: no
connection: local
tasks:
- name: run the show commands
ios_command:
commands:
- show version
host: "{{ inventory_hostname }}"
username: cisco
password: cisco
register: version
- debug: var=version.stdout[0].Version