Using ansible 1.5.4, the command
lineinfile: dest=/etc/bash.bashrc line="bind '\"\e[B\"':history-search-forward"
added the line
bind '"\e[B"':history-search-forward
to /etc/bash.bashrc
perfectly fine.
On ansible 1.9.1, the same ansible instruction produces the following line, which messes the quotes I escaped in the lineinfile command:
bind \e[B:history-search-forward
How can I fix the quotes, so that the correct line is added
You can usually avoid some of escaping mess by using the multiline form of input, especially when entering colons:
command: > curl -X POST -H 'Content-Type: application/json' --data '{"name": "{{ item.name }}", "comment": "{{ item.comment }}", "DefaultDistribution": "{{ item.default_distribution }}", "DefaultComponent": "{{ item.default_component }}" }' http://localhost:8080/api/repos
I wrote a little Ansible playbook that I think does what you want (although to a test file instead of the actual bashrc.
I have run this and I get this line in testfile.txt:
I am using Ansible 2.1.1.0. I don't know if that differs from 1.9.1