# Syntax error while using Ansible docker module

**URL:** <https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535>\
**Category:** Ansible Project\
**Created:** [October 17, 2015, 5:54pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535 "2015-10-17T17:54:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kunal\_Pariani](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kunal\_Pariani](https://forum.ansible.com/u/Kunal_Pariani)\
**Post date:** [October 17, 2015, 5:54pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535/1 "2015-10-17T17:54:51Z")

</div>

Hello,  
I mm new to Ansible and trying to use its docker module to start docker containers. I have all the prereqs installed on the docker host

> - python \>= 2.6
> - docker-py \>= 0.3.0
> - The docker server \>= 0.10.0

But i get a syntax error while trying to run the ansible playbook. No clue why its throwing that error. Any ideas on what am i missing here ?

$ ansible-playbook -vvvv -i hosts …/wildfly-docker.yml  
ERROR: Syntax Error while loading YAML script, …/wildfly-docker.yml  
Note: The error may actually appear before this position: line 7, column 5

docker:  
name: wildfly-1  
^

Here is my playbook file

---

<div class="post-metadata">

**Author:** ![Kunal\_Pariani](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kunal\_Pariani](https://forum.ansible.com/u/Kunal_Pariani)\
**Post date:** [October 19, 2015, 11:27pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535/2 "2015-10-19T23:27:37Z")

</div>

> This error got fixed when i moved the section under tasks to a different YML file and included that file in this one and it worked 🙂

Although i got moved to new error now  
TASK: [Wildfly container#1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [159.203.249.12] =\> {“error”: “NotFound(HTTPError(u’404 Client Error: Not Found for url: http+docker://localunixsocket/v1.20/images/create?tag=latest&fromImage=jboss%2Fwildfly’,),)”, “failed”: true}  
msg: Failed to pull the specified image: jboss/wildfly

Doing ‘docker pull jboss/wildfly’ directly on the host works fine.

Thanks  
-Kunal

---

<div class="post-metadata">

**Author:** ![Kunal\_Pariani](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kunal\_Pariani](https://forum.ansible.com/u/Kunal_Pariani)\
**Post date:** [October 23, 2015, 8:31pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535/3 "2015-10-23T20:31:19Z")

</div>

Anyone has a clue on this ? Would appreciate any feedback on this.

Thanks

---

<div class="post-metadata">

**Author:** ![Markus\_Ellers](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@Markus\_Ellers](https://forum.ansible.com/u/Markus_Ellers)\
**Post date:** [October 25, 2015, 7:20pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535/4 "2015-10-25T19:20:23Z")

</div>

are you doing the docker pull with root directly on the machine too? Maybe some of the environment variables that are needed to make the connection are not loaded.

---

<div class="post-metadata">

**Author:** ![Vikas\_Kumar](https://avatars.discourse-cdn.com/v4/letter/v/ecb155/32.png) [@Vikas\_Kumar](https://forum.ansible.com/u/Vikas_Kumar)\
**Post date:** [October 25, 2015, 10:02pm UTC](https://forum.ansible.com/t/syntax-error-while-using-ansible-docker-module/19535/5 "2015-10-25T22:02:58Z")

</div>

Hi Kunal,

I don’t have a machine to confirm, but I guess there is a syntax error in your playbook. A new block should have two spaces of indentation. Try to make that change and see.

Regards,  
Vikas
