--syntax-ckeck won't check syntax from variable-included files

18 views
Skip to first unread message

Thomas Faucher

unread,
Nov 16, 2016, 12:06:47 PM11/16/16
to ansible...@googlegroups.com
Hello,


I noticed that --syntax-check won't check the syntax from included files
if the include statement is based on a variable.


I have an include statement such as:

$ head -n 3 roles/mongodb/tasks/main.yml
---
- include: mongodb_{{ ansible_architecture }}.yml


Let's fuzz on of our included task file:

$ figlet 'py.test' >> roles/mongodb/tasks/mongodb_armv7l.yml


Then check the syntax:

$ ansible-playbook main.yml --syntax-check
statically included: roles/system/tasks/ralink.yml
statically included: roles/system/tasks/realtek.yml
statically included: roles/system/tasks/lime2.yml
statically included: roles/ideascube/tasks/branding.yml
statically included: roles/ideascube/tasks/ideascube.yml
statically included: roles/ideascube/tasks/ext_hdd.yml
statically included: roles/ideascube/tasks/../../../post_install.yml
statically included: roles/kiwix/tasks/kiwix.yml
statically included: roles/kiwix/tasks/dust-removal.yml
statically included: roles/kiwix/tasks/update_catalog.yml
statically included: roles/kiwix/tasks/../../../post_install.yml
statically included: roles/mongodb/tasks/../../../post_install.yml
statically included: roles/mook/tasks/back_end.yml
statically included: roles/mook/tasks/front_end.yml
statically included: roles/mook/tasks/system.yml
statically included: roles/mook/tasks/../../../post_install.yml
statically included: roles/mook/tasks/back_end.yml
statically included: roles/mook/tasks/front_end.yml
statically included: roles/mook/tasks/system.yml
statically included: roles/mook/tasks/../../../post_install.yml
statically included: roles/appinventor/tasks/appinventor.yml
statically included: roles/appinventor/tasks/../../../post_install.yml
statically included: roles/kalite/tasks/kalite.yml
statically included: roles/kalite/tasks/ext_hdd.yml
statically included: roles/kalite/tasks/import_videos.yml
statically included: roles/kalite/tasks/../../../post_install.yml

playbook: main.yml
$

Here we are, roles/mongodb/tasks/mongodb_armv7l.yml is not tested.
Is there anyway to "fix" this behaviour?

--
Thomas

Brian Coca

unread,
Nov 16, 2016, 2:32:44 PM11/16/16
to ansible...@googlegroups.com
It cannot check syntax of dynamically included files, this would also affect include and include_roles. Since those would need actually executing the tasks.


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages