Hi,
I've tried to configure Cisco smartport macros via ansible mit
ios_config/cli_config.
Both failed with an timeout.
It looks like this on the serial console:
TN_lra00sw03(config)#macro auto execute TEST1_LRA_CISCO_SWITCH {
{..} > if [[ $LINKUP == YES ]]
then.else.fi> then
then.else.fi> conf t
then.else.fi> interface $INTERFACE
then.else.fi> description linkupmacro
then.else.fi> exit
then.else.fi> end
then.else.fi> fi
{..} > if [[ $LINKUP == NO ]]
then.else.fi> then
then.else.fi> conf t
then.else.fi> interface $INTERFACE
then.else.fi> description linkdownmacro
then.else.fi> exit
then.else.fi> end
then.else.fi> fi
{..} >}
TN_lra00sw03(config)#exit
My Playbook:
---
- name : set Macros
hosts: switches
connection: network_cli
gather_facts: true
tasks:
- debug:
msg: "{{lookup('template', 'test1.j2')}}"
- name: cli test
cli_config:
config: "{{lookup('template', 'test1.j2')}}"
multiline_delimiter: "@"
My template:
macro auto execute TEST1_LRA_CISCO_SWITCH {
if [[ $LINKUP == YES ]]
then
conf t
interface $INTERFACE
description linkupmacro
exit
end
fi
if [[ $LINKUP == NO ]]
then
conf t
interface $INTERFACE
description linkdownmacro
exit
end
fi
}
@
Ansible console output:
~/dev/cisco_ios_macros ansible-playbook set_macros.yml -l TN_00sw03 -k -u
ansible -v
PLAY [set Macros]
*********************************************************************************************************************************************
TASK [Gathering Facts]
****************************************************************************************************************************************
ok: [TN_00sw03.spm.local]
TASK [debug]
**************************************************************************************************************************************************
ok: [TN_00sw03] => {
"msg": "macro auto execute TEST1_LRA_CISCO_SWITCH { \n if [[ $LINKUP
== YES ]] \n then \n conf t \n interface $INTERFACE \n
description linkupmacro \n exit \n end \n fi \n if [[ $LINKUP == NO
]] \n then \n conf t \n interface $INTERFACE \n description
linkdownmacro \n exit \n end \n fi \n} \n@\n"
}
TASK [cli test]
***********************************************************************************************************************************************
fatal: [TN_00sw03]: FAILED! => {"changed": false, "msg": "timeout value 30
seconds reached while trying to send command: b'macro auto execute
TEST1_CISCO_SWITCH {'"}
PLAY RECAP
****************************************************************************************************************************************************
TN_00sw03 : ok=2 changed=0 unreachable=0 failed=1 skipped=0
rescued=0 ignored=0
Anyone who knows an solution?
Bye
--
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/6da85c2e-2273-48cf-8f5e-ecfeda0ac61fo%40googlegroups.com.