# Ansible up and running book - first playbook exampe

**URL:** <https://forum.ansible.com/t/ansible-up-and-running-book-first-playbook-exampe/18560>\
**Category:** Ansible Project\
**Created:** [June 20, 2015, 11:38pm UTC](https://forum.ansible.com/t/ansible-up-and-running-book-first-playbook-exampe/18560 "2015-06-20T23:38:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Deloubes](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Julien\_Deloubes](https://forum.ansible.com/u/Julien_Deloubes)\
**Post date:** [June 20, 2015, 11:38pm UTC](https://forum.ansible.com/t/ansible-up-and-running-book-first-playbook-exampe/18560/1 "2015-06-20T23:38:42Z")

</div>

Hello,  
just learning Ansible with Vagrant and the help of the book “Ansible up and running”.

I cannot execute the first playbook in the book i always had a syntax error.  
Ansible version: 1.9.1

Playbook :

- name: Configure webserver with nginx  
hosts: webservers  
sudo: True  
tasks:
- name: install nginx  
apt: name=nginx update\_cache=yes
- name: copy nginx config file  
copy: src=files/nginx.conf dest=/etc/nginx/sites-available/default
- name: enable configuration  
file: \>  
dest=/etc/nginx/sites-enabled/default  
src=/etc/nginx/sites-available/default  
state=link
- name: copy index.html  
template: src=templates/index.html.j2 dest=/usr/share/nginx/html/index.html  
mode=0644
- name: restart nginx  
service: name=nginx state=restarted

Error:  
ERROR: Syntax Error while loading YAML script, web-notls.yml  
Note: The error may actually appear before this position: line 3, column 2

- name: Configure webserver with nginx  
hosts: webservers  
^

I couldn’t find where the syntax is faulty here, do you have any clues?

Thanks.

---

<div class="post-metadata">

**Author:** ![Rodney\_Quillo](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Rodney\_Quillo](https://forum.ansible.com/u/Rodney_Quillo)\
**Post date:** [June 22, 2015, 1:47pm UTC](https://forum.ansible.com/t/ansible-up-and-running-book-first-playbook-exampe/18560/2 "2015-06-22T13:47:09Z")

</div>

Hmm, looks like you have incorrect sequence for your playbook.  
There are existing sample you can try from:

[https://github.com/ansible/ansible-examples](https://github.com/ansible/ansible-examples)  
[https://gist.github.com/marktheunissen/2979474](https://gist.github.com/marktheunissen/2979474)

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 22, 2015, 1:52pm UTC](https://forum.ansible.com/t/ansible-up-and-running-book-first-playbook-exampe/18560/3 "2015-06-22T13:52:24Z")

</div>

I think you just need to line up your whitespace correctly. Indentation level is significant in YAML - have a look at the yaml primer [http://docs.ansible.com/YAMLSyntax.htmlor](http://docs.ansible.com/YAMLSyntax.htmlor) use yamlint if you need to check your playbook.

Hope this helps.

Jon
