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

前端 未结 5 1920
無奈伤痛
無奈伤痛 2020-12-03 06:47

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

elasticsearch: \"http://\"+window.location.hostname+\":9200\"         


        
5条回答
  •  孤街浪徒
    2020-12-03 07:29

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

    lineinfile:
    'dest=/var/www/kibana/config.js
    backrefs=true
    regexp="(elasticsearch.* \"http.*)$"
    line="elasticsearch\: \ {{ elasticsearch_URL }}:{{ elasticsearch_port }} \ "
    state=present'  
    

    See these pages:
    Link-1 Link-2 Link-3

提交回复
热议问题