You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 27, 2024. It is now read-only.
Hi Guys, I am a network engineer and new to Ansible automation, i am trying configure the nexus switch interfaces as mentioned in the play book, i don't face issue getting result from ios_command module but issues is happening from ios_config module, i don't understand what is the issue, please help me, i have pasted the playbook and error logs below,
name: view
hosts: nx-01
tasks:
name: view
ios_command:
commands: "show run | inc hostname"
register: output
ios_config:
parents:
"interface {{ item.name }}"
lines:
"duplex {{ item.duplex }}"
"speed {{ item.speed }}"
no shutdown
with_items:
name: Ethernet1/41
duplex: full
speed: auto
name: Ethernet1/42
duplex: full
speed: auto
when: "'nx-01' in output.stdout[0]"
Error as follows
ASK [ios_config] *************************************************************************************************************************************
task path: /root/ansible/bkrishna/configure_interface.yml:12
<10.52.144.16> attempting to start connection
<10.52.144.16> using connection plugin network_cli
<10.52.144.16> found existing local domain socket, using it!
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> updating play_context for connection
<10.52.144.16>
<10.52.144.16> local domain socket path is /root/.ansible/pc/2ca293a755
<10.52.144.16> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.52.144.16> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668" && echo ansible-tmp-1587230237.46-23430985453668="echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668" ) && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_config.py
<10.52.144.16> PUT /root/.ansible/tmp/ansible-local-4736CdB5fR/tmpCslH41 TO /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py
<10.52.144.16> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/ /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 102, in
_ansiballz_main()
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in
File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main
KeyError: 'banner_diff'
failed: [nx-01] (item={u'duplex': u'full', u'speed': u'auto', u'name': u'Ethernet1/41'}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"duplex": "full",
"name": "Ethernet1/41",
"speed": "auto"
},
"module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in \n File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main\nKeyError: 'banner_diff'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
<10.52.144.16> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559" && echo ansible-tmp-1587230239.43-245761390249559="echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559" ) && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_config.py
<10.52.144.16> PUT /root/.ansible/tmp/ansible-local-4736CdB5fR/tmp63vVYb TO /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py
<10.52.144.16> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/ /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 102, in
_ansiballz_main()
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in
File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main
KeyError: 'banner_diff'
failed: [nx-01] (item={u'duplex': u'full', u'speed': u'auto', u'name': u'Ethernet1/42'}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"duplex": "full",
"name": "Ethernet1/42",
"speed": "auto"
},
"module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in \n File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main\nKeyError: 'banner_diff'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Hi Guys, I am a network engineer and new to Ansible automation, i am trying configure the nexus switch interfaces as mentioned in the play book, i don't face issue getting result from ios_command module but issues is happening from ios_config module, i don't understand what is the issue, please help me, i have pasted the playbook and error logs below,
name: view
hosts: nx-01
tasks:
name: view
ios_command:
commands: "show run | inc hostname"
register: output
ios_config:
parents:
lines:
with_items:
duplex: full
speed: auto
duplex: full
speed: auto
when: "'nx-01' in output.stdout[0]"
Error as follows
ASK [ios_config] *************************************************************************************************************************************
task path: /root/ansible/bkrishna/configure_interface.yml:12
<10.52.144.16> attempting to start connection
<10.52.144.16> using connection plugin network_cli
<10.52.144.16> found existing local domain socket, using it!
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.52.144.16> updating play_context for connection
<10.52.144.16>
<10.52.144.16> local domain socket path is /root/.ansible/pc/2ca293a755
<10.52.144.16> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.52.144.16> EXEC /bin/sh -c '( umask 77 && mkdir -p "
echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668
" && echo ansible-tmp-1587230237.46-23430985453668="echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668
" ) && sleep 0'Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_config.py
<10.52.144.16> PUT /root/.ansible/tmp/ansible-local-4736CdB5fR/tmpCslH41 TO /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py
<10.52.144.16> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/ /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 102, in
_ansiballz_main()
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in
File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main
KeyError: 'banner_diff'
failed: [nx-01] (item={u'duplex': u'full', u'speed': u'auto', u'name': u'Ethernet1/41'}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"duplex": "full",
"name": "Ethernet1/41",
"speed": "auto"
},
"module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230237.46-23430985453668/AnsiballZ_ios_config.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in \n File "/tmp/ansible_ios_config_payload_0fTom9/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main\nKeyError: 'banner_diff'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
<10.52.144.16> EXEC /bin/sh -c '( umask 77 && mkdir -p "
echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559
" && echo ansible-tmp-1587230239.43-245761390249559="echo /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559
" ) && sleep 0'Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_config.py
<10.52.144.16> PUT /root/.ansible/tmp/ansible-local-4736CdB5fR/tmp63vVYb TO /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py
<10.52.144.16> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/ /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py && sleep 0'
<10.52.144.16> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 102, in
_ansiballz_main()
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in
File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main
KeyError: 'banner_diff'
failed: [nx-01] (item={u'duplex': u'full', u'speed': u'auto', u'name': u'Ethernet1/42'}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"duplex": "full",
"name": "Ethernet1/42",
"speed": "auto"
},
"module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-4736CdB5fR/ansible-tmp-1587230239.43-245761390249559/AnsiballZ_ios_config.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.ios.ios_config', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 569, in \n File "/tmp/ansible_ios_config_payload_1QTXmG/ansible_ios_config_payload.zip/ansible/modules/network/ios/ios_config.py", line 481, in main\nKeyError: 'banner_diff'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
PLAY RECAP ********************************************************************************************************************************************
nx-01 : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
The text was updated successfully, but these errors were encountered: