Literal curly braces (raw)
Ansible makes heavy use of Jinja for templating. Notably, variables can be referenced using double curly braces:
name: "{{ app_name }}"If we want to type literal double curly braces, e.g. for use in a docker or podman format string, we can use a raw section:
- name: Check if container is running
  command: podman ps -a --filter "name={{ app_name }}" --format "{% raw %}{{.State}}{% endraw %}"
  register: container_state
  changed_when: False{{ app_name }} will be replaced with a variable value, while {{.State}} won't be.
Last updated
Was this helpful?