# How to use template inside of shell creates conditional check?

**URL:** <https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666>\
**Category:** Ansible Project\
**Created:** [November 3, 2014, 12:00am UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666 "2014-11-03T00:00:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [November 3, 2014, 12:00am UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666/1 "2014-11-03T00:00:16Z")

</div>

Hi,

The following examples gave me a syntax error, appreciate clues to use template inside creates statement.

shell: “cp /tmp/{{ my\_server }}.crt /etc/{{ my\_server }}.crt”  
args:  
creates: /etc/{{ my\_server }}.crt

Thank you.

Kind regards,

- j

---

<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:** [November 3, 2014, 1:44am UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666/2 "2014-11-03T01:44:35Z")

</div>

It might help to actually state what the “syntax error” is.

Also what version of ansible are you using?

---

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [November 3, 2014, 3:59am UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666/3 "2014-11-03T03:59:51Z")

</div>

Thanks Matt, please see following comments:

> It might help to actually state what the “syntax error” is.

ERROR: Syntax Error while loading YAML script copyCert.yml

creates: /etc/{{ my\_server }}.crt  
^

> Also what version of ansible are you using?

ansible-1.7-1.el6.noarch

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 3, 2014, 2:34pm UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666/4 "2014-11-03T14:34:36Z")

</div>

If you share the whole exception you should find it’s giving you helper text telling you what to do with it.

Let us know if not.

meanwhile, it seems you are doing a local copy, which is a little curious compared to doing a remote copy (copy module).

All being said, this is the simplest possible representation:

shell: cp /tmp/{{my\_server}}.crt /etc/{{my\_server}}.crt creates=/etc/{{my\_server}}.crt

---

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [November 4, 2014, 12:20am UTC](https://forum.ansible.com/t/how-to-use-template-inside-of-shell-creates-conditional-check/16666/5 "2014-11-04T00:20:13Z")

</div>

Thanks Michael, that does the trick.

Much appreciate it.
