You seem to be missing `tasks:` in your first play.  As such YAML wasn't
expecting you to start a list there.

On Thu, Sep 21, 2017 at 3:03 PM, Bob Tanner <basictheprog...@gmail.com>
wrote:

> I'm following this post, https://www.ibm.com/developerworks/cloud/library/
> cl-provision-docker-containers-ansible/index.html, and Listing 11
>
> ---
> - name: initialize provisioning
>   hosts: docker
>
>   - name: start up target container
>     docker:
>       image: python:2.7
>       name: lab
>       pull: missing
>       detach: yes
>       tty: yes
>       command: sleep infinity
>       state: started
>   # dynamically update inventory to make it available down the playbook
>   - name: register new container hostname
>     add_host: name=lab
>
> - name: provision container
>   connection: docker
>   hosts: lab
>   tasks:
>       # ...
>
> - name: finalize build
>   hosts: docker
>   tasks:
>     - name: stop container
>       docker:
>         name: lab
>         image: python:2.7
>         state: stopped
>
>
>
> But ansible-playbook throws an error
> ERROR! Syntax Error while loading YAML.
>
>  The error appears to have been in '/Users/tanner/projects/
> ansible.git/playbooks.git/docker-testing.yml': line 5, column 3, but may
> be elsewhere in the file depending on the exact syntax problem. The
> offending line appears to be: - name: start up target container ^ here
> exception type: <class 'yaml.parser.ParserError'> exception: while
> parsing a block mapping in "<unicode string>", line 2, column 3: - name:
> initialize provisioning ^ expected <block end>, but found '-' in "<unicode
> string>", line 5, column 3: - name: start up target container ^
> Why?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/8272e557-4555-450b-9ef0-f7d48f817441%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/8272e557-4555-450b-9ef0-f7d48f817441%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9o00JYtgpAVT74PocENWJ6MwUMDL%3D9-PRC-5ftvcEA4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to