The below code is being used to append to a config file. What I want to do is introduce a loop loop: "{{ INTERFACE }}"
, but this does not work (as the temp file will be overwritten), template
doesn't have an append option.
Any suggestions on how to fix?
- name: Build CE config Cisco
template:
src=/opt/netsec/ansible/orchestration/cisco_templates/NOKIA_T1_PORT.js
dest=/opt/netsec/ansible/orchestration/config_outputs/tmp/{{CE_HOSTNAME}}
loop: "{{ INTERFACE }}"
- name: Build PE config Cisco output
shell: cat /opt/netsec/ansible/orchestration/config_outputs/tmp/{{CE_HOSTNAME}} >> /opt/netsec/ansible/orchestration/config_outputs/new/{{CE_HOSTNAME}}.conf
INTERFACES
looks like this:
INTERFACES:
- INTERFACE: Gi0/3/0
EQUIPMENT_DESCRIPTION: ETHXXXXSR01
- INTERFACE: Gi0/3/1
EQUIPMENT_DESCRIPTION: ETHXXXXSR01_STANDBY