01-04-2021 09:19 PM - edited 01-04-2021 09:23 PM
When I try to execute the devenet lab for ansible_part_2 on the TASK retrieving NX-OS facts always receive something like an unsupported parameters message, I have checked reachability to the NX-OS but seems that this error mean that the Task 1 is not properly gathering the info from the NX-OS switches, here a capture of the response:
/home/ccontrerd/.local/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography.exceptions import InvalidSignature PLAY [Retrieve facts from Switches] ***************************************************************************************************************************************************************************** TASK [Gathering Facts] ****************************************************************************************************************************************************************************************** ok: [172.16.30.101] ok: [172.16.30.102] ok: [172.16.30.103] ok: [172.16.30.104] TASK [Retrieving NX-OS Facts] *********************************************************************************************************************************************************************************** [DEPRECATION WARNING]: Param 'provider' is deprecated. See the module docs for more information. This feature will be removed from ********.nxos in a release after 2022-06-01. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. fatal: [172.16.30.103]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (nxos_facts) module: host, transport Supported parameters include: gather_network_resources, gather_subset, provider"} fatal: [172.16.30.101]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (nxos_facts) module: host, transport Supported parameters include: gather_network_resources, gather_subset, provider"} fatal: [172.16.30.102]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (nxos_facts) module: host, transport Supported parameters include: gather_network_resources, gather_subset, provider"} fatal: [172.16.30.104]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (nxos_facts) module: host, transport Supported parameters include: gather_network_resources, gather_subset, provider"} PLAY RECAP ****************************************************************************************************************************************************************************************************** 172.16.30.101 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 172.16.30.102 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 172.16.30.103 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 172.16.30.104 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 ccontrerd@DESKTOP-GVH4CDV:~/code/netprog_basics/netdevops/ansible_part_2$
Anyone that could suggest some possible problem that causes this response? I have cloned completely the files so I don´t think this could be a typo
Regards,
01-05-2021 01:57 AM
Hello @carlocon can you share the link to the learning content you are following please, i can then ask the correct team to look at this.
Many thanks!
01-05-2021 10:04 AM
Hi @bigevilbeard I am signed to this lab https://devnetsandbox.cisco.com/RM/Diagram/Index/b9ed254c-1fed-4879-91ea-e4d777935583
And trying to execute the examples from this video https://www.youtube.com/watch?v=S4frPFhbxOY&feature=emb_logo basically is the ansible part 2 example, I cloned the complete examples from github.com/CiscoDevnet/netprog_basics, once cloned the path to the example I am running is /netprog_basics/netdevops/ansible_part_2/ and the I am trying to execute the following play books:
ansible-playbook example1.yaml (this is from the output came from)
Before that I had to manually start in VIRL the 4 NX-OS switches (supposed that this were on by default). I can ping to them and also ssh. I have enabled the feature nxapi as is requested on the example, despite all this, seems the output from this script is the one I included, let me know if you need any other info,
Regards,
01-06-2021 04:38 AM
@carlocon I test this today. I tested using Ansible version, i had to create my ansible_env file and set this as the source
(new_venv)$ ansible --version WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error. ansible 2.4.2.0 config file = None configured module search path = [u'/Users/stuaclar/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /Library/Python/2.7/site-packages/ansible executable location = /usr/local/bin/ansible python version = 2.7.16 (default, Jun 5 2020, 22:59:21) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
The results are quite verbose as you would expect when it returns the data (this does take a few minutes FYI)
PLAY RECAP ********************************************************************************************************************************************************************************** 172.16.30.101 : ok=3 changed=0 unreachable=0 failed=0 172.16.30.102 : ok=3 changed=0 unreachable=0 failed=0 172.16.30.103 : ok=3 changed=0 unreachable=0 failed=0 172.16.30.104 : ok=3 changed=0 unreachable=0 failed=0
Check your ansible version, the requirements file in the repo is ansible==2.4.2.0.
01-06-2021 09:20 AM
Thanks @bigevilbeard since my reservation is up I'll need to reschedule to try again, let you know, here is the output of the release of ansible that I have on my local computer:
ccontrerd@DESKTOP-GVH4CDV:~$ ansible --version
/home/ccontrerd/.local/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
ansible 2.10.4
config file = None
configured module search path = [u'/home/ccontrerd/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/ccontrerd/.local/lib/python2.7/site-packages/ansible
executable location = /home/ccontrerd/.local/bin/ansible
python version = 2.7.18 (default, Aug 4 2020, 11:16:42) [GCC 9.3.0]
ccontrerd@DESKTOP-GVH4CDV:~$
Seems quite similar, regarding the ansible_env file could you describe what is in the content of this, I think there is one default on the directory I use but would be good to double check what you included so I can validate if is properly configured on my directory,
best regards,
01-06-2021 09:54 AM
Looking at your much newer version i wonder if this is the issue, as this content was created in 2017 some time has passed. I had to create the ansible_env file as it was trying login under my local username. In the ansible_part_2 folder. I did.
touch ansible_env
The open and add the following
# Setup environment for ansible playbooks # Credentials for DevNet Open NX-OS Sandbox # https://devnetsandbox.cisco.com # usage: source .ansible_env # Authentication for ansible network modules export ANSIBLE_NET_USERNAME=cisco export ANSIBLE_NET_PASSWORD=cisco
01-06-2021 11:45 AM
OK great @bigevilbeard , I try to test creating the ansible_env on the local directory, also I thought the same thing about the version, unfortunately when I downloaded the ansible release seems that was the one that I got from the repository, I will try again an report is maybe the issue is the newer release
Regards,
01-07-2021 01:01 AM
If you create a new venv, pip install the requirements file in the folder, this will give you the right version.
(venv)$ pwd /netprog_basics/netdevops/ansible_part_2 (venv) :ansible_part_2 $ cat requirements.txt ansible==2.4.2.0 ncclient==0.5.3 paramiko==2.2.1 requests==2.18.4
01-13-2021 09:39 PM - edited 01-13-2021 09:42 PM
Hi @bigevilbeard finally I was able to execute the first example with all your recommendations, here part of the output:
(nx_os) ccontrerd@DESKTOP-GVH4CDV:~/code/netprog_basics/netdevops/ansible_part_2$ ansible-playbook example1.yaml
/home/ccontrerd/code/netprog_basics/netdevops/ansible_part_2/nx_os/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
PLAY [Retrieve facts from Switches] ************************************************************************************
TASK [Gathering Facts] *************************************************************************************************ok: [172.16.30.101]
ok: [172.16.30.104]
ok: [172.16.30.103]
ok: [172.16.30.102]
TASK [Retrieving NX-OS Facts] ******************************************************************************************
[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
[WARNING]: command show lldp neighbors failed, facts will not be populated
ok: [172.16.30.102]
ok: [172.16.30.104]
ok: [172.16.30.101]
ok: [172.16.30.103]
TASK [Print NX-OS Facts] ***********************************************************************************************
ok: [172.16.30.101] => {
"msg": {
"ansible_facts": {
"ansible_net_all_ipv4_addresses": [
"172.16.30.101",
"192.168.0.1"
],
"ansible_net_all_ipv6_addresses": [],
"ansible_net_filesystems": [
"bootflash:"
],
"ansible_net_gather_subset": [
"hardware",
"default",
"interfaces",
"legacy"
],
"ansible_net_hostname": "nx-osv9000-1",
"ansible_net_image": "bootflash:///nxos.9.2.1.bin",
"ansible_net_interfaces": {
"Ethernet1/1": {
"bandwidth": 1000000,
"description": "Ethernet1/1",
"duplex": "full",
"macaddress": "fa16.3e00.1001",
"mtu": "1500",
"speed": "1000 Mb/s",
"state": "up",
"type": "100/1000/10000 Ethernet"
},
"Ethernet1/10": {
"bandwidth": 10000000,
"duplex": "auto",
"macaddress": "aaaa.aaaa.aabb",
"mode": "access",
"mtu": "1500",
"speed": "auto-speed",
"state": "down",
"type": "100/1000/10000 Ethernet"
},
However now moving to example2 (I though that this would be now easy) I am getting this output, seems the reponse of the ansible playbook is that is failing to create the loopbacks (however I can´t understand why since there is no more info on the reply just simple fail, naturally the rest of the tasks on the script such as assigning a description, IP address etc. also fail. Here is the output and my question is if you can figure out what could be happening this time or some clue to try to get it right, thanks for the support
(nx_os) ccontrerd@DESKTOP-GVH4CDV:~/code/netprog_basics/netdevops/ansible_part_2$ ansible-playbook example2.yaml
/home/ccontrerd/code/netprog_basics/netdevops/ansible_part_2/nx_os/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
PLAY [Configure Loopback Networks on Each Switch] *****************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************
ok: [172.16.30.101]
ok: [172.16.30.102]
ok: [172.16.30.104]
ok: [172.16.30.103]
TASK [Create Loopback Interface] **********************************************************************************************************************************************************
failed: [172.16.30.103] (item={u'prefix': 24, u'ip_address': u'172.23.1.1', u'name': u'Loopback11', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.23.1.1", "name": "Loopback11", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.101] (item={u'prefix': 24, u'ip_address': u'172.21.1.1', u'name': u'Loopback11', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.21.1.1", "name": "Loopback11", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.104] (item={u'prefix': 24, u'ip_address': u'172.24.1.1', u'name': u'Loopback11', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.24.1.1", "name": "Loopback11", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.102] (item={u'prefix': 24, u'ip_address': u'172.22.1.1', u'name': u'Loopback11', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.22.1.1", "name": "Loopback11", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.104] (item={u'prefix': 24, u'ip_address': u'172.24.2.1', u'name': u'Loopback12', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.24.2.1", "name": "Loopback12", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.101] (item={u'prefix': 24, u'ip_address': u'172.21.2.1', u'name': u'Loopback12', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.21.2.1", "name": "Loopback12", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.102] (item={u'prefix': 24, u'ip_address': u'172.22.2.1', u'name': u'Loopback12', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.22.2.1", "name": "Loopback12", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.103] (item={u'prefix': 24, u'ip_address': u'172.23.2.1', u'name': u'Loopback12', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.23.2.1", "name": "Loopback12", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.103] (item={u'prefix': 24, u'ip_address': u'172.23.3.1', u'name': u'Loopback13', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.23.3.1", "name": "Loopback13", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.104] (item={u'prefix': 24, u'ip_address': u'172.24.3.1', u'name': u'Loopback13', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.24.3.1", "name": "Loopback13", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.102] (item={u'prefix': 24, u'ip_address': u'172.22.3.1', u'name': u'Loopback13', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.22.3.1", "name": "Loopback13", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.101] (item={u'prefix': 24, u'ip_address': u'172.21.3.1', u'name': u'Loopback13', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.21.3.1", "name": "Loopback13", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.103] (item={u'prefix': 24, u'ip_address': u'172.23.4.1', u'name': u'Loopback14', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.23.4.1", "name": "Loopback14", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.104] (item={u'prefix': 24, u'ip_address': u'172.24.4.1', u'name': u'Loopback14', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.24.4.1", "name": "Loopback14", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.102] (item={u'prefix': 24, u'ip_address': u'172.22.4.1', u'name': u'Loopback14', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.22.4.1", "name": "Loopback14", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
failed: [172.16.30.101] (item={u'prefix': 24, u'ip_address': u'172.21.4.1', u'name': u'Loopback14', u'desc': u'Sample Network Route Injection'}) => {"changed": false, "failed": true, "item": {"desc": "Sample Network Route Injection", "ip_address": "172.21.4.1", "name": "Loopback14", "prefix": 24}, "msg": "timeout trying to send command: show interface | json"}
to retry, use: --limit @/home/ccontrerd/code/netprog_basics/netdevops/ansible_part_2/example2.retry
PLAY RECAP ********************************************************************************************************************************************************************************
172.16.30.101 : ok=1 changed=0 unreachable=0 failed=1
172.16.30.102 : ok=1 changed=0 unreachable=0 failed=1
172.16.30.103 : ok=1 changed=0 unreachable=0 failed=1
172.16.30.104 : ok=1 changed=0 unreachable=0 failed=1
(nx_os) ccontrerd@DESKTOP-GVH4CDV:~/code/netprog_basics/netdevops/ansible_part_2$
01-14-2021 12:55 AM
Awesome @carlocon congrats!
01-14-2021 08:06 AM
Thanks for the recognition @bigevilbeard
Regards,
01-14-2021 10:08 AM
This commands take a while to run in my experience and i think what you are seeing here is a timeout - run the same playbook with the -vvv at the end. If you need to increase the timeout https://docs.ansible.com/ansible/latest/network/user_guide/network_debug_troubleshooting.html#timeout-issues
Hope this helps!
01-14-2021 10:11 AM
Great @bigevilbeard I'll check the link and try it this evening on the sandbox, hopefully this could be the fix to this,
Regards,
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide