I'm trying to find a way to write the original {{ ansible_host }}
var in to a xml file.
This variable will replace a static IP in a device config.
The reason that I want to replace this IP with the original variable in the file, is because later in my playbook that variable gives me the option to make the file compatible with multiple devices.
What I have:
- name: Replace static ip in config file to Ansible variable
xml:
path: '{{ backup_folder }}{{ inventory_hostname }}.xml'
xpath: /config/devices/entry/deviceconfig/system/ip-address
value: "{{ ansible_host }}"
state: present
Result (in file):
<ip-address>10.0.89.103</ip-address>
What it needs to be:
<ip-address>{{ ansible_host }}</ip-address>
Does anyone know how to do this? Thanks