Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转义单引号Ansible 2.1_Ansible_Ansible 2.x - Fatal编程技术网

转义单引号Ansible 2.1

转义单引号Ansible 2.1,ansible,ansible-2.x,Ansible,Ansible 2.x,使用Ansible 2.1 ansible all -i 127.0.0.1, -m lineinfile -a "dest=/etc/engine/engine.json state=present regexp=\"rpc_json\" line='\"rpc_json\": \"127.0.0.1:54321\"'," 命令起作用,但增加了 '"rpc_json": "127.0.0.1:54321"', 请告诉我如何删除单个报价,以便 "rpc_json": "127.0

使用Ansible 2.1

ansible all -i 127.0.0.1, -m lineinfile   -a    "dest=/etc/engine/engine.json state=present regexp=\"rpc_json\" line='\"rpc_json\": \"127.0.0.1:54321\"'," 
命令起作用,但增加了

'"rpc_json": "127.0.0.1:54321"',
请告诉我如何删除单个报价,以便

"rpc_json": "127.0.0.1:54321",

与其说是回答问题,不如说是回答问题:

ansible all -i 127.0.0.1, -m lineinfile -a 'dest=/etc/engine/engine.json state=present regexp=rpc_json line='\''"rpc_json": "127.0.0.1:54321",'\'

'\'
中,首先
'
关闭字符串,然后
\'
粘贴转义的单引号,然后
'
开始粘贴下一个字符串。

这是一个更为棘手的问题,而不是答案:

ansible all -i 127.0.0.1, -m lineinfile -a 'dest=/etc/engine/engine.json state=present regexp=rpc_json line='\''"rpc_json": "127.0.0.1:54321",'\'
'\'
中,首先
'
关闭字符串,然后
\'
粘贴转义的单引号,然后
'
开始粘贴下一个字符串