I am trying to write the following string with Ansible lininfile
.
The failing Ansible task:
- name: Insert GetInterfaceIP
lineinfile:
path: /etc/consul.d/consul.hcl
regexp: '^advertise'
line: advertise_addr = "{{ GetInterfaceIP `eth0` }}"
Desired result in the file:
advertise_addr = "{{ GetInterfaceIP `eth0` }}"
How can I escape the special characters so that the line is written to the file exactly like this?