Hi!

This is a bit of "bootstrapping" that you need to do with Ansible.

You can either set the host_key_checking parameter to false in your 
ansible.cfg file or make sure log in to your network devices and accept the 
key prior to running your playbook.


# 
https://docs.ansible.com/ansible/2.4/intro_getting_started.html#host-key-checking
# False disables host key checking in your ssh known_hosts file <--Use with 
Caution!!!
host_key_checking=False


Here is a repo I use for training
https://github.com/cldeluna/cisco_ios

The ansible.cfg file is in there an annotated with settings that are useful 
if you are working with network devices (well..the settings that I find 
useful when working with network devices :D).

Claudia


On Sunday, April 26, 2020 at 1:06:47 PM UTC-7, Dhaval Mandalia wrote:
>
> fyi, here's the "vrf_getter.yml" playbook:
>
> ---
> - name: "PLAY 1: Capture and store VRF config"
>   hosts: alltestnodes
>   connection: network_cli
>
>   tasks:
>     - name: "Task 1: Get VRF config from alltestnodes"
>       eos_command:
>         commands: show running-config | section vrf definition
>       register: cli_result
>  
>     - name: "Task 2: Print VRF output"
>       debug:
>         msg: "{{ cli_result }}"
>
> On Sunday, April 26, 2020 at 12:54:06 PM UTC-7, Dhaval Mandalia wrote:
>>
>> [root@smartbox ansible]# ansible alltestnodes -m raw -a "sh vrf | i mgmt" 
>> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
>> to allow bad characters in group names by default, this will change, but 
>> still be 
>> user configurable on deprecation. This feature will be removed in version 
>> 2.10. Deprecation warnings can be disabled by setting 
>> deprecation_warnings=False in 
>> ansible.cfg.
>> [WARNING]: Invalid characters were found in group names but not replaced, 
>> use -vvvv to see details
>>
>> ln-br1.ln.com | CHANGED | rc=0 >>
>>    mgmt       <not set>       ipv4,ipv6       v4:no routing,              
>>  
>> Shared connection to ln-br1.ln.com closed.
>>
>>
>> usc-br1.usc.edu | CHANGED | rc=0 >>
>>    mgmt       <not set>       ipv4,ipv6       v4:no routing,              
>>  
>> Shared connection to usc-br1.usc.edu closed.
>>
>>
>> [root@smartbox ansible]# ansible-playbook vrf_getter.yml                  
>> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
>> to allow bad characters in group names by default, this will change, but 
>> still be 
>> user configurable on deprecation. This feature will be removed in version 
>> 2.10. Deprecation warnings can be disabled by setting 
>> deprecation_warnings=False in 
>> ansible.cfg.
>> [WARNING]: Invalid characters were found in group names but not replaced, 
>> use -vvvv to see details
>>
>>
>> PLAY [PLAY 1: Capture and store VRF config] 
>> *******************************************************************************************************************
>>
>> TASK [Gathering Facts] 
>> ****************************************************************************************************************************************
>> [WARNING]: Ignoring timeout(10) for eos_facts
>>
>> [WARNING]: Ignoring timeout(10) for eos_facts
>>
>> fatal: [ln-br1.ln.com]: FAILED! => {"ansible_facts": {}, "changed": 
>> false, "failed_modules": {"eos_facts": {"ansible_facts": 
>> {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, 
>> "invocation": {"module_args": {"auth_pass": null, "authorize": null, 
>> "gather_network_resources": null, "gather_subset": ["all"], "host": null, 
>> "password": null, "port": null, "provider": null, "ssh_keyfile": null, 
>> "timeout": null, "transport": null, "use_ssl": null, "username": null, 
>> "validate_certs": null}}, "msg": "paramiko: The authenticity of host '
>> ln-br1.ln.com' can't be established.\nThe ssh-rsa key fingerprint is 
>> 6c918908c1aab6d3af0edfaa7e3e574b."}}, "msg": "The following modules failed 
>> to execute: eos_facts\n"}
>> fatal: [usc-br1.usc.edu]: FAILED! => {"ansible_facts": {}, "changed": 
>> false, "failed_modules": {"eos_facts": {"ansible_facts": 
>> {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, 
>> "invocation": {"module_args": {"auth_pass": null, "authorize": null, 
>> "gather_network_resources": null, "gather_subset": ["all"], "host": null, 
>> "password": null, "port": null, "provider": null, "ssh_keyfile": null, 
>> "timeout": null, "transport": null, "use_ssl": null, "username": null, 
>> "validate_certs": null}}, "msg": "paramiko: The authenticity of host '
>> usc-br1.usc.edu' can't be established.\nThe ssh-rsa key fingerprint is 
>> 78914e12cdb9107994641c98f2b939ed."}}, "msg": "The following modules failed 
>> to execute: eos_facts\n"}
>>
>> PLAY RECAP 
>> ****************************************************************************************************************************************************
>> ln-br1.ln.com              : ok=0    changed=0    unreachable=0    
>> failed=1    skipped=0    rescued=0    ignored=0   
>> usc-br1.usc.edu            : ok=0    changed=0    unreachable=0    
>> failed=1    skipped=0    rescued=0    ignored=0   
>>
>> [root@smartbox ansible]# 
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fc1e4e6d-1bae-409d-bce5-f8d3be3352a3%40googlegroups.com.

Reply via email to