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.
Op vrijdag 27 december 2013 15:22:06 UTC+1 schreef Matt Martz:
>
> 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
>
> --
> Matt Martz
> [email protected] <javascript:>
>
> On December 27, 2013 at 8:05:50 AM, TextEditor
> ([email protected]<javascript:>)
> wrote:
>
> Even when a broken playbook or a broken yaml file is includes as role it
> validates as correct with 1.4.
>
> Op vrijdag 27 december 2013 08:16:26 UTC+1 schreef TextEditor:
>>
>> 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.
>>
>>
>> Op vrijdag 27 december 2013 02:23:52 UTC+1 schreef Matt Martz:
>>>
>>> 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.
>>> --
>>> Matt Martz
>>> [email protected]
>>>
>>> On December 26, 2013 at 5:50:45 PM, TextEditor ([email protected]) wrote:
>>>
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>> --
> 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 [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.