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: --- - fail: msg="Please provide a profile name. Profile name can be qa|qa2|prod1|prod2|staging" when: profile is undefined - fail: msg="Invalid profile. Profile name can be qa|qa2|prod1|prod2|staging " when: not((profile == 'qa') or (profile == 'qa2') or (profile == 'prod1') or (profile == 'prod2') or (profile == 'prod3') or (profile == 'staging')) #Extract the file name pointed to by the mwportal link - name: Get file name of the war file to deploy local_action: shell readlink -f {{local_repo}}apiserver register: res - set_fact: war_file_dir_absolute_path="{{remote_repo}}{{ res.stdout.split('/')[-1].split('.')[0] }}" war_file_dir_basename="{{ res.stdout.split('/')[-1].split('.')[0] }}" - debug: msg="{{war_file_dir_absolute_path}}" - name: create a dir to unzip war file file: name={{war_file_dir_absolute_path}} state=directory - name: Unzip the war file unarchive: src={{local_repo}}apiserver dest={{war_file_dir_absolute_path}} #Copy the profiles from the WEB-INF/classes/profiles/XX directory to WEB-INF/classes - name: Copy properties files to WEB-INF/classes shell: cp {{war_file_dir_absolute_path}}/WEB-INF/classes/{{profile}}/* {{war_file_dir_absolute_path}}/WEB-INF/classes/ - name: Ensure there are no residual folders from previus failed installation command: rm -rf /usr/local/{{war_file_dir_basename}}-{{profile}} #notify: #- Restart Tomcat7 - name: Move the war file to /usr/local command: mv {{war_file_dir_absolute_path}} /usr/local/{{war_file_dir_basename}}-{{profile}} # notify: # - Restart Tomcat7 - name: Create a symlink file: name=/usr/local/apiserver src={{war_file_dir_basename}}-{{profile}} state=link force=yes # notify: # - Restart Tomcat7 - name: Restart tomcat service: name=tomcat7 state=restarted ... Am I doing something wrong here? If check is not the correct way to check the correctness of YAML config then what is? Thank you. -- 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/c5d32881-ca15-40ac-87cd-1818b9a6d460%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.