# Problem with executing playbook with fetch command.

**URL:** <https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877>\
**Category:** Ansible Project\
**Created:** [November 27, 2015, 4:02pm UTC](https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877 "2015-11-27T16:02:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcel\_Golus](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Marcel\_Golus](https://forum.ansible.com/u/Marcel_Golus)\
**Post date:** [November 27, 2015, 4:02pm UTC](https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877/1 "2015-11-27T16:02:12Z")

</div>

Hello guys!

I want to share with you my problem which is pretty strange in my point of view.

My playbook looks as follows:

- name:fetch configuration  
gather\_facts: true  
hosts: ‘{{ h }}’  
sudo: true  
sudo\_user: admin  
tasks:
- shell: tar czf /tmp/tomcat-conf.tar.gz /var/test/conf/\*
- fetch: src=/tmp/tomcat-conf.tar.gz dest=/tmp/tomcat-conf-{{ ansible\_hostname }} flat=yes

I run this as:

ansible-playbook fetch-conf.yml -e {“h”:“hostname”}

I got error:  
ERROR: Expecting property name: line 1 column 1 (char 1)

I don’t have error when I change hosts variable hosts: ‘hostname’ instead of hosts: ‘{{ h }}’

I want to execute this on group of servers that’s why I have to use variable {{ h }}

Anyone can advice/help in this case?

Best Regards,  
Marcel

---

<div class="post-metadata">

**Author:** ![Marcel\_Golus](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Marcel\_Golus](https://forum.ansible.com/u/Marcel_Golus)\
**Post date:** [December 1, 2015, 10:45am UTC](https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877/2 "2015-12-01T10:45:03Z")

</div>

Hi again,

Anybody have idea in this case?

Best Regards,  
Marcel

---

<div class="post-metadata">

**Author:** ![Paul\_Markham](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@Paul\_Markham](https://forum.ansible.com/u/Paul_Markham)\
**Post date:** [December 2, 2015, 4:12am UTC](https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877/3 "2015-12-02T04:12:34Z")

</div>

Looks like you need single quote around the extra variable:

> ansible-playbook fetch-conf.yml -e ‘{“h”:“hostname”}’

Using key=value also works:

> ansible-playbook fetch-conf.yml -e ‘h=hostname’

You also need a space after ‘name:’ on the first line.

---

<div class="post-metadata">

**Author:** ![Marcel\_Golus](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Marcel\_Golus](https://forum.ansible.com/u/Marcel_Golus)\
**Post date:** [December 2, 2015, 7:56am UTC](https://forum.ansible.com/t/problem-with-executing-playbook-with-fetch-command/19877/4 "2015-12-02T07:56:36Z")

</div>

Hello Paul,

Cool it works, I didn’t know that this was so much easy 🙂 I tried different ways but not came up with this idea.

Thanks and have a nice day!

BR,  
Marcel
