Some parameters are shown as illegal while running --check option in playbook

Hi All,

I am trying to do a syntax check on all my .yaml files before running ansible-playbook. I am using version 2.0.2.0. However some modules give error saying that they are “illegal parameters” in an Ansible play.

I am using role based system and these “illegal parameters” are in my roles/ROLENAME/tasks/main.yaml files. Examples of these parameters are fail,register. However the funny thing is that the playbook runs absolutely fine. Only when i do ansible-playbook myYAMLFILE.yaml --check do I get these errors. Sample errors:

ERROR: fail is not a legal parameter of an Ansible Play

ERROR: register is not a legal parameter of an Ansible Play

Sample playbook:

what you are showing is NOT a play, but a task list, you need a play (normally - hosts: )