unable to find syntax error in simple playbook.

195 views
Skip to first unread message

Dave Thacker

unread,
Jul 15, 2014, 12:05:09 AM7/15/14
to ansible...@googlegroups.com
Ansible 1.6.2 on Oracle Linux 6.5. This is my first playbook.

Version 1
ansible@devansible01 playbooks]$ cat nfs_mounts.yml
---
- hosts: all
  tasks:
- name: create directory for use in NFS mount
  file: path=/sa group=root owner=root mode=755 state=directory

Results for Version 1
[ansible@devansible01 playbooks]$ ansible-playbook  nfs_mounts.yml
ERROR: file is not a legal parameter in an Ansible Playbook

Version 2 (using command instead of file)
[ansible@devansible01 playbooks]$ cat nfs_mounts.yml
---
- hosts: all
  tasks:
- name: create directory for use in NFS mount
  command: mkdir /sa


Results for Version 2
ansible-playbook  nfs_mounts.yml
ERROR: command is not a legal parameter in an Ansible Playbook

I'm consistently breaking at the point where I specify the module.  I know that whitespace is critical, but I have not been able to spot the error.
Any tips for a novice?

Thanks in Advance
Dave


Lucas, Sascha

unread,
Jul 16, 2014, 2:54:32 AM7/16/14
to ansible...@googlegroups.com
Hi,

> ansible@devansible01 playbooks]$ cat nfs_mounts.yml
> ---
> - hosts: all
>  tasks:
> - name: create directory for use in NFS mount
>   file: path=/sa group=root owner=root mode=755 state=directory

I guess there is a missing indentation after tasks. The error message says it treats file as a parameter of a play and not of a task:

---
- hosts: all
tasks:
- name: create directory for use in NFS mount
file: path=/sa group=root owner=root mode=755 state=directory

HTH, Sascha.

Stellvertretender Vorsitzender des Aufsichtsrates: Detlef Hillebrand
Geschäftsführung: Michael Krüger
Sitz der Gesellschaft: Halle/Saale
Registergericht: Amtsgericht Stendal | Handelsregister-Nr. HRB 208414
UST-ID-Nr. DE 158253683

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Empfänger sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail oder des Inhalts dieser Mail sind nicht gestattet. Diese Kommunikation per E-Mail ist nicht gegen den Zugriff durch Dritte geschützt. Die GISA GmbH haftet ausdrücklich nicht für den Inhalt und die Vollständigkeit von E-Mails und den gegebenenfalls daraus entstehenden Schaden. Sollte trotz der bestehenden Viren-Schutzprogramme durch diese E-Mail ein Virus in Ihr System gelangen, so haftet die GISA GmbH - soweit gesetzlich zulässig - nicht für die hieraus entstehenden Schäden.

Michael DeHaan

unread,
Jul 16, 2014, 7:48:21 PM7/16/14
to ansible...@googlegroups.com
You have an indentation issue with content below tasks.




--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1db297bd-58e8-4159-9db3-c47d2796d71d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages