try below.. you need to register the output & the use debug to display the
stdout of register...
---
- name: Checking running cisco config
hosts: ios
gather_facts: no
connection: local
tasks:
- name: SHOW CONFIGURATION
ios_command:
commands:
- show version
- show interface summary
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
register: ios_out
- debug: msg="{{ ios_out.stdout }}"
On Monday, October 30, 2017 at 5:36:48 PM UTC+5:30, Peter Sprygada wrote:
>
> run with -v (or -vvv) to see the output of the task on the command line
>
> use register to further process the output (
> http://docs.ansible.com/ansible/latest/playbooks_variables.html#registered-variables
> )
>
> On Thu, Oct 26, 2017 at 9:41 AM, <[email protected] <javascript:>>
> wrote:
>
>>
>>
>> On Thursday, October 26, 2017 at 9:39:37 AM UTC-4, [email protected]
>> wrote:
>>>
>>> Hello Friends,
>>>
>>> I've just picked up network automation with ansible and this is my first
>>> attempt to build a very simple playbook to run "show version" on Cisco IOS
>>> router.Although, playbook runs successfully but i can't see any output from
>>> the router when playbook runs
>>>
>>> ----> ansible-playbook -i inventory config.yml
>>> [DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading
>>> as it can also be a list of
>>> hosts, a directory or a list of paths . This feature will be removed in
>>> version 2.8. Deprecation warnings
>>> can be disabled by setting deprecation_warnings=False in ansible.cfg.
>>>
>>> PLAY [RUNNING CONFIG]
>>> ************************************************************************************
>>>
>>> TASK [SHOW CONFIGURATION]
>>> ********************************************************************************
>>> [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: [switch1]
>>>
>>> PLAY RECAP
>>> ***********************************************************************************************
>>> switch1 : ok=1 changed=0 unreachable=0
>>> failed=0
>>>
>>>
>>> *My YAML file:-*
>>>
>>> cat config.yml
>>> ---
>>>
>>> - name: RUNNING CONFIG
>>> hosts: ios
>>> gather_facts: no
>>> connection: local
>>>
>>> tasks:
>>>
>>> - name: SHOW CONFIGURATION
>>> ios_command:
>>> commands:
>>> - show version
>>> - show interface summary
>>> username: "{{ un }}"
>>> password: "{{ pwd }}"
>>> host: "{{ inventory_hostname }}"
>>>
>>> Am i missing something? Appreciate your support.
>>>
>>> Thanks,
>>> Dipak
>>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/49b14432-3fbb-4342-9671-962e3e2bfd4a%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/49b14432-3fbb-4342-9671-962e3e2bfd4a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/33055b7f-25de-4c98-999c-5b72154799b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.