# escaping a backslash in a playbook

**URL:** <https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584>\
**Category:** Ansible Project\
**Created:** [February 15, 2016, 3:24pm UTC](https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584 "2016-02-15T15:24:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ter\_Alexander](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Ter\_Alexander](https://forum.ansible.com/u/Ter_Alexander)\
**Post date:** [February 15, 2016, 3:24pm UTC](https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584/1 "2016-02-15T15:24:54Z")

</div>

I have a playbook that calls get\_url to download a file BUT the URL contains a backslash

[http://cijboss:8080/jenkins/job/prod/186/org.myorg\$ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear](http://cijboss:8080/jenkins/job/prod/186/org.myorg%5C$ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear)"  
I have tried double quotes, single quotes, \ escape sequences, etc. Have tried the many things found in Jinja2 and YAML escaping documents and nothing works. When I feed the URL through an ad hoc command, it downloads the file just fine.

ansible -m get\_url -u user -a “[http://cijboss:8080/jenkins/job/prod/186/org.myorg\$ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear](http://cijboss:8080/jenkins/job/prod/186/org.myorg%5C$ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear)” dest=/home/user"  
Each time the playbook runs, the url contains a double backslash. How does one properly escape this?

Update: Below is the yml playbook file.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 15, 2016, 3:36pm UTC](https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584/2 "2016-02-15T15:36:35Z")

</div>

I think you probably want to url encode that instead of just trying to escape those characters.

[http://cijboss:8080/jenkins/job/prod/186/org.myorg%5C%24ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear](http://cijboss:8080/jenkins/job/prod/186/org.myorg%5C%24ear/artifact/org.org/ear/3.0.0-SNAPSHOT/ear-3.0.0-SNAPSHOT.ear)

---

<div class="post-metadata">

**Author:** ![Ter\_Alexander](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Ter\_Alexander](https://forum.ansible.com/u/Ter_Alexander)\
**Post date:** [February 15, 2016, 4:31pm UTC](https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584/3 "2016-02-15T16:31:33Z")

</div>

Thank you. I am still getting 404’s on that URL when fed through the playbook. Was trying to exhaust all options before submitting a bug request. Any other ideas?

---

<div class="post-metadata">

**Author:** ![Christian\_Thiemann](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@Christian\_Thiemann](https://forum.ansible.com/u/Christian_Thiemann)\
**Post date:** [February 19, 2016, 8:30pm UTC](https://forum.ansible.com/t/escaping-a-backslash-in-a-playbook/20584/4 "2016-02-19T20:30:03Z")

</div>

Are you using Ansible 2.0? If so, it might be related to this: [https://github.com/ansible/ansible/issues/14172](https://github.com/ansible/ansible/issues/14172)
