ISSUE TYPE
COMPONENT NAME
ios_template module
ANSIBLE VERSION
ansible 2.2.0 (devel 56ba10365c) last updated 2016/05/05 09:00:05 (GMT +300)
lib/ansible/modules/core: (detached HEAD 9db1233521) last updated 2016/05/04 17:31:47 (GMT +300)
lib/ansible/modules/extras: (detached HEAD 675d778b50) last updated 2016/05/04 17:31:47 (GMT +300)
config file = /home/admin/ansible.cfg
configured module search path = Default w/o overrides
CONFIGURATION
[defaults]
inventory = hosts.cfg
host_key_checking = False
OS / ENVIRONMENT
[admin@ansible ~]$ cat /etc/redhat-release
Fedora release 22 (Twenty Two)
[admin@ansible ~]$ uname -a
Linux ansible.ag.lab 4.3.4-200.fc22.x86_64 #1 SMP Mon Jan 25 13:37:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[admin@ansible ~]$ python --version
Python 2.7.10
SUMMARY
ios_template module doesnt render {% for %} correctly in template:
router ospf {{ospf.process}}
{% for i in ospf.passive_ifaces %}
passive-interface {{i}}
{% endfor %}
exit
{% for area in ospf.areas %}
{% for iface in area.ifaces %}
interface {{iface}}
ip ospf {{ospf.process}} area {{area.id}}
exit
{% endfor %}
{% endfor %}
if iterating over nested variable structure like this:
ospf:
process: 1
areas:
- id: 0
ifaces:
- gi1
- gi2
- gi3
passive_ifaces:
- gi3
STEPS TO REPRODUCE
- get and install any Cisco IOS-XE router (my case: CSR1000V, X86_64_LINUX_IOSD-UNIVERSALK9-M, Version 15.4(2)S, RELEASE SOFTWARE (fc2)
- git clone https://github.com/artgromov/ansible_modules_core_issues_3601 to ansible host
- cd ansible_ios_module_issue
- ansible-playbook play-net.yml
I suppose that you may not need step 1 if you erase first tasks from playbook.
EXPECTED RESULTS
Expected debug output for each host:
ok: [10.1.10.33] => {
"check": {
"changed": true,
"responses": [
"",
"",
"",
"",
"",
"",
""
],
"updates": [
"router ospf 1",
"passive-interface gi3",
"exit",
"interface gi1",
"ip ospf 1 area 0",
"exit",
"interface gi2",
"ip ospf 1 area 0",
"exit",
"interface gi3",
"ip ospf 1 area 0"
"exit",
]
}
}
ACTUAL RESULTS
The module missed some lines during render. Routers didn't get full config changes.
Current debug output for each host:
ok: [10.1.10.33] => {
"check": {
"changed": true,
"responses": [
"",
"",
"",
"",
"",
"",
""
],
"updates": [
"router ospf 1",
"passive-interface gi3",
"exit",
"interface gi1",
"interface gi2",
"interface gi3",
"ip ospf 1 area 0"
]
}
}
ISSUE TYPE
COMPONENT NAME
ios_template module
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
ios_template module doesnt render {% for %} correctly in template:
if iterating over nested variable structure like this:
STEPS TO REPRODUCE
I suppose that you may not need step 1 if you erase first tasks from playbook.
EXPECTED RESULTS
Expected debug output for each host:
ACTUAL RESULTS
The module missed some lines during render. Routers didn't get full config changes.
Current debug output for each host: