Below is my playbook to gather ios_facts info in GNS3 router. The output shows "VARIABLE IS NOT DEFINED!"
But when i gather ios_facts using ad-hoc command, it works. Why the difference? ---------------------------------------------------------------------------------------- name: PLAYBOOK 1 hosts: R1 gather_facts: true connection: network_cli - vars: ansible_network_os: ios tasks: - name: IOS facts ios_facts: gather_subset: all register: print_output - debug: var=print_output.stdout_lines OUTPUT: PLAY [PLAYBOOK 1] *************************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************** ok: [R1] TASK [IOS facts] **************************************************************************************************************************************************************************************************************************** ok: [R1] TASK [debug] ******************************************************************************************************************************************************************************************************************************** ok: [R1] => *{ "print_output.stdout_lines": "VARIABLE IS NOT DEFINED!" }* PLAY RECAP ********************************************************************************************************************************************************************************************************************************** R1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -------------------------------------------------------------------------------------------------------------------------------- *AD-HOC command:* ansible all -i "192.168.122.72", -c network_cli -u david-user -k -m ios_facts -e ansible_network_os=ios SSH password: [WARNING]: default value for gather_subset will be changed to min from !config v2.11 onwards 1*92.168.122.72 | SUCCESS *=> { "ansible_facts": { "ansible_net_all_ipv4_addresses": [ "192.168.122.72" ], "ansible_net_all_ipv6_addresses": [], "ansible_net_api": "cliconf", "ansible_net_filesystems": [], "ansible_net_filesystems_info": {}, -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/93716c61-bc42-46bf-9eaf-08dd63c4f854n%40googlegroups.com.