Question:
How to escape double curly braces in Ansible 1.9.2?
For instance, how can I escape double curly braces in the following shell command?
1 2 3 |
- name: Test shell: "docker inspect --format '{{ .NetworkSettings.IPAddress }}' instance1" |
Answer:
Whenever you have problems with conflicting characters in Ansible, a rule of thumb is to output them as a string in a Jinja expression.
So instead of {{
you would use {{ '{{' }}
:
1 2 |
- debug: msg="docker inspect --format '{{ '{{' }} .NetworkSettings.IPAddress {{ '}}' }}' instance1" |