# \--syntax-check fails on 1.4.with ERROR: MODULE is not a legal parameter in an Ansible Playbook

**URL:** <https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224>\
**Category:** Ansible Project\
**Created:** [December 26, 2013, 11:50pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224 "2013-12-26T23:50:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 26, 2013, 11:50pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/1 "2013-12-26T23:50:44Z")

</div>

Since my bug report is ignored and closed I’m asking for support here. Since the upgrade to Ansible 1.4 the --syntax-check feature broke when used with role files.

This is the ticket: [--syntax-check fails on 1.4.with ERROR: MODULE is not a legal parameter in an Ansible Playbook · Issue #5412 · ansible/ansible · GitHub](https://github.com/ansible/ansible/issues/5412)

–syntax-check fails on 1.4.with ERROR: MODULE is not a legal parameter in an Ansible Playbook

The --syntax-check option does not work for me. Ansible 1.4.3, installed via pip on OS X 10.9.

Basic playbook which consists out of a few roles:

# cat ./playbooks/default-vps-setup.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 27, 2013, 12:01am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/2 "2013-12-27T00:01:52Z")

</div>

Saw your ticket, as stated, it could not be reproduced.

– Michael

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 27, 2013, 1:23am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/3 "2013-12-27T01:23:52Z")

</div>

I believe the issue is that you are running a --syntax-check against something that is not a playbook. The error message actually states that as well:

"ERROR: apt is not a legal parameter in an Ansible Playbook”

And that is a correct error, as ‘apt’ is not a legal parameter in a playbook.

From the looks of things, you are running --syntax-check against yaml files from a role.

The syntax of a playbook and a role are inherently different.

When you do a --syntax-check on a playbook, it will run through the entirety of the playbook, all includes, etc…and return the status of the full syntax check.

Is there a reason you are attempting to run it on all yaml files and not just running it on your playbooks? Seems like you are taking some unnecessary steps.

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 27, 2013, 7:16am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/4 "2013-12-27T07:16:26Z")

</div>

It is run on the YAML files because when run on just the playbook which includes the roles it does not check the includes roles.

And, as also can be seen in the ticket, checking of all the YAML files with Ansible 1.3 did work just fine.

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 27, 2013, 7:17am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/5 "2013-12-27T07:17:38Z")

</div>

I can clearly reproduce it with my set of playbooks here. Did you try it with the playbook in the ticket? As in, the playbook and the vim role. That alone gives the error on 1.4 and not on 1.3.

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 27, 2013, 2:05pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/6 "2013-12-27T14:05:47Z")

</div>

Even when a broken playbook or a broken yaml file is includes as role it validates as correct with 1.4.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 27, 2013, 2:21pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/7 "2013-12-27T14:21:58Z")

</div>

This command is only intended for running on the top level playbook. It is not intended for running directly on task files which are by definition not playbooks.

– Michael

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 27, 2013, 2:22pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/8 "2013-12-27T14:22:06Z")

</div>

Sorry, I forgot to mention, when looking through the code, I realized in order to get it to check all the roles too, you need to use the --list-tasks argument too:

ansible-playbook --syntax-check --list-tasks site.yml

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 27, 2013, 6:35pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/9 "2013-12-27T18:35:30Z")

</div>

Seems logical. Can you maybe explain why it worked in 1.3 on task files?

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 27, 2013, 6:37pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/10 "2013-12-27T18:37:08Z")

</div>

And that one does work with 1.4:

ansible-playbook --syntax-check --list-tasks -i tests/ansible\_hosts ./playbooks/default-vps-setup.yml

[…]

ERROR: Syntax Error while loading YAML script, /home/remy/ansible/playbooks/roles/vim/tasks/main.yml  
Note: The error may actually appear before this position: line 3, column 7

- apt:“;;::D”‘’:d;dsfds pkg=vim-tiny state=latest update\_cache=yes  
sudo: yes  
^

Thank you both Michael and Mart.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 27, 2013, 6:52pm UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/11 "2013-12-27T18:52:03Z")

</div>

Doesn’t matter as it is for playbooks.

– Michael

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 28, 2013, 8:23am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/12 "2013-12-28T08:23:03Z")

</div>

OK. Yet again, thanks for the help.

---

<div class="post-metadata">

**Author:** ![TextEditor1](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@TextEditor1](https://forum.ansible.com/u/TextEditor1)\
**Post date:** [December 28, 2013, 8:23am UTC](https://forum.ansible.com/t/syntax-check-fails-on-1-4-with-error-module-is-not-a-legal-parameter-in-an-ansible-playbook/14224/13 "2013-12-28T08:23:16Z")

</div>

OK. Yet again, thanks for the help.
