# Escaping curly braces in a dictionary.

**URL:** <https://forum.ansible.com/t/escaping-curly-braces-in-a-dictionary/19917>\
**Category:** Ansible Project\
**Created:** [December 2, 2015, 4:18pm UTC](https://forum.ansible.com/t/escaping-curly-braces-in-a-dictionary/19917 "2015-12-02T16:18:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian.lycett](https://avatars.discourse-cdn.com/v4/letter/b/3d9bf3/32.png) [@brian.lycett](https://forum.ansible.com/u/brian.lycett)\
**Post date:** [December 2, 2015, 4:18pm UTC](https://forum.ansible.com/t/escaping-curly-braces-in-a-dictionary/19917/1 "2015-12-02T16:18:18Z")

</div>

Hi. I’m struggling to escape double curly braces in a dictionary. I’ve tried the {{ ‘{{’ }} blah {{ ‘}}’ }} method, tried using backslashes and also tried using {% raw %}{{blah}}{% endraw %}  
I need to be able to do this as datadog uses curly braces in its alerts as macros.

Here’s an example I’m using to debug:

vars/main.yml:

datadog\_alerts:

- name: “Testy test test McTest {{ ‘{{’ }}host.name{{ ‘}}’ }}”  
query: “‘testhost.status’.over(‘\*’).by(‘check’,‘id’).last(2).count\_by\_status()”  
type: service check  
message: ‘Testy test test test test’

tasks/main.yml:

- name: List datadog monitors  
debug: “{{ item.type }} {{ item.name }} {{ item.query }}”  
with\_items: datadog\_alerts

Running that play (Ansible v2.1.0) results in:

TASK [datadog-alerts : List datadog monitors] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ERROR! ‘host’ is undefined”}

as it’s trying to interpolate host.name.

Does anyone have any ideas on how to get around this?

Regards,

Brian
