[ansible-project] `run_once` used together with `when` not generating expected result

2016-01-18 Thread Qiu Yu
Hi, I have following playbook, which I expect it to run only once, on one of the `group2` hosts. site.yml --- - hosts: - group1 - group2 roles: - { role: test } roles/test/tasks/main.yml --- - include: test.yml when: inventory_hostname in groups['group2']

Re: [ansible-project] `run_once` used together with `when` not generating expected result

2016-01-18 Thread Qiu Yu
On Monday, January 18, 2016 at 7:30:58 AM UTC-8, Brian Coca wrote: > > run_once limits the task to run on the 'first host' in the current > play, so the when only evaluates for that host, if that host is not in > 'group2' it will be skipped an no other host will be evaluated. > Does that mean

Re: [ansible-project] `run_once` used together with `when` not generating expected result

2016-01-18 Thread Qiu Yu
On Monday, January 18, 2016 at 10:49:08 AM UTC-8, Brian Coca wrote: > > This is tricky, task includes are now dynamic in 2.0. Before 2.0 the > when: does not stop the include from happening, it just gets applied > to each included task, in 2.0 it does that only if the when cannot be > resolved