Using 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\"',"
That commands works but adds
'"rpc_json": "127.0.0.1:54321"',
Please how do i remove the single quote, so i can have
"rpc_json": "127.0.0.1:54321",
It is more bash question than ansible:
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",'\'
In '\'' first ' closes string, then \' glues escaped single quote, then ' starts next string to be glued.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With