How can escape colon in a string within an Ansible YAML file?

Question:

I want to change one line of my code in file /var/www/kibana/config.js during installation from

to

Here I tried to use lineinfile to do that as show below

I have set variables of {{elasticsearch_URL}} and {{elasticsearch_port}} to http://192.168.1.200 and 9200, respectively.

Here is the error message I met:

Answer:

you need to enclose the entire line in ", where : appears.

Leave a Reply