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: 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
---
- hosts: local
  user: remy
  connection: ssh # or paramiko

  roles:
    - { role: basic-debian-setup, sudo: yes }
    - { role: git-setup }
    - { role: vim }
    - { role: bash }
    - { role: screen }
    - { role: openssh, sudo: yes }
    - { role: fail2ban, sudo: yes }
    - { role: sudo, sudo: yes }
    - { role: postfix, sudo: yes }
    - { role: vnstat, sudo: yes }

Specific role:

# cat playbooks/roles/vim/tasks/main.yml
---
- apt: pkg=vim-tiny state=latest update_cache=yes
  sudo: yes

- file: path=/home/{{ user }}/.vimrc src=/home/{{ user }}/conf/vimrc 
state=link owner={{ user }} force=yes
  sudo: no

The command fails: ansible-playbook --syntax-check -i tests/ansible_hosts 
./playbooks/roles/vim/tasks/main.yml

Result:

playbook: ./playbooks/roles/vim/tasks/main.yml

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

When manually setting the Library path it also fails:

ANSIBLE_LIBRARY=/usr/share/ansible/ ansible-playbook --syntax-check -i 
tests/ansible_hosts ./playbooks/roles/vim/tasks/main.yml

playbook: ./playbooks/roles/vim/tasks/main.yml

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

When checking the playbook which includes the roles it always works, even 
when the included roles do not exist or are syntaxically incorrect.

This worked on Ansible 1.3. (checking the individual files).

I noticed this because my CI started bombarding me with emails. (It checks 
my ansible repository with this command: find ./playbooks/roles -name 
'*.yml' -not -path './roles/*/files/*' | xargs -t -n1 ansible-playbook 
--syntax-check -i tests/ansible_hosts.)


This was a clean install of Ansible to test. On a new VM with 1.3 it works, 
a new VM with 1.4 fails.

And it is not just the APT module, it is every module. See the full output 
here:

     find ./playbooks -name '*.yml' -not -path './playbooks/group_vars/*' 
-not -path './playbooks/roles/*/files/*' | xargs -n1 ansible-playbook 
--syntax-check -i tests/ansible_hosts

    playbook: ./playbooks/debug.yml



    playbook: ./playbooks/default-vps-setup.yml



    playbook: ./playbooks/nginx-vps-for-raymii.org.yml



    playbook: ./playbooks/roles/bash/tasks/main.yml

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

    playbook: ./playbooks/roles/basic-debian-setup/tasks/main.yml

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

    playbook: ./playbooks/roles/debug/tasks/main.yml

    ERROR: register is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/fail2ban/handlers/main.yml

    ERROR: service is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/fail2ban/tasks/main.yml

    ERROR: apt is not a legal parameter in an Ansible Playbook
    ERROR: parse error: playbooks must be formatted as a YAML list

    playbook: ./playbooks/roles/git-setup/tasks/main.yml

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

    playbook: ./playbooks/roles/nginx/handlers/main.yml

    ERROR: service is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/nginx/tasks/main.yml

    ERROR: template is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/openssh/handlers/main.yml

    ERROR: service is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/openssh/tasks/main.yml

    ERROR: apt is not a legal parameter in an Ansible Playbook
    ERROR: parse error: playbooks must be formatted as a YAML list

    playbook: ./playbooks/roles/postfix/handlers/main.yml

    ERROR: service is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/postfix/tasks/main.yml

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

    playbook: ./playbooks/roles/screen/tasks/main.yml

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

    playbook: ./playbooks/roles/sudo/tasks/main.yml

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

    playbook: ./playbooks/roles/vim/tasks/main.yml

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

    playbook: ./playbooks/roles/vnstat/handlers/main.yml

    ERROR: action is not a legal parameter in an Ansible Playbook

    playbook: ./playbooks/roles/vnstat/tasks/main.yml

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


On a  fresh install of Ansible 1.3 it all works, on a fresh install (both 
in new clean VM's) of 1.4 it fails.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to