include when not work

43 views
Skip to first unread message

Steve Kieu

unread,
Sep 27, 2015, 9:46:18 PM9/27/15
to Ansible Project
Hi team,

I have something like this in my tasks file.

- name: run post sync files
  include: "{{inventory_dir}}/../tasks/post-sync-files.yml"
  when: POST_SYNC_FILE == 'yes'

Even the value of POST_SYNC_FILE is 'no' it still include the yml file and run . Inside the yml file there are bunch of tasks whihc also use when as well but not using the above variables.

Not sure what is wrong with this?

Thanks

Brian Coca

unread,
Sep 28, 2015, 8:36:52 AM9/28/15
to Ansible Project
The 'when' is being applied to the included tasks so they should all
appear as skipped, before 2.0 there is no way to prevent the include
itself from happening.



--
Brian Coca

Steve Kieu

unread,
Sep 28, 2015, 7:14:53 PM9/28/15
to Ansible Project
I guess it is time to try version 2 then. 

Thanks

Brian Coca

unread,
Sep 28, 2015, 7:34:15 PM9/28/15
to Ansible Project
the only effective difference is less output

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