我想在安装期间更改文件/var/www/kibana/config.js中的一行代码
elasticsearch: "http://"+window.location.hostname+":9200"
至
elasticsearch: "http://192.168.1.200:9200"
在这里,我尝试使用lineinfile来执行此操作,如下所示
- name: Comment out elasticsearch the config.js to ElasticSearch server lineinfile: dest=/var/www/kibana/config.js backrefs=true regexp="(elasticsearch.* \"http.*)$" line="elasticsearch\: \" {{ elasticsearch_URL }}:{{ elasticsearch_port }} \" " state=present
我已经设置的变量{{elasticsearch_URL}}
,并{{elasticsearch_port}}
以http://192.168.1.200
和9200
分别.
这是我遇到的错误消息:
ERROR: Syntax Error while loading YAML script, /Users/shuoy/devops_workspace/ansible_work/logging-for-openstack/roles/kibana/tasks/Debian.yml Note: The error may actually appear before this position: line 29, column 25 regexp="(elasticsearch.* \"http.*)$" line="elasticsearch\: \" {{ elasticsearch_URL }}:{{ elasticsearch_port }} \" " ^
小智.. 23
你需要将整行包含"
在:
出现的位置.
lineinfile: 'dest=/var/www/kibana/config.js backrefs=true regexp="(elasticsearch.* \"http.*)$" line="elasticsearch\: \ {{ elasticsearch_URL }}:{{ elasticsearch_port }} \ " state=present'
请参阅以下页面:
Link-1 Link-2 Link-3