Hi,
I have following playbook, which I expect it to run only once, on one of the group2
hosts.
site.yml
`
Hi,
I have following playbook, which I expect it to run only once, on one of the group2
hosts.
site.yml
`
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 the include
statement will be evaluated first no matter if when
statement is satisfied or not?
QY
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 with the information available at the time of the include.
That explains a lot! Thanks Brian!!
QY
I banged my head against this same thing months ago until it finally clicked on what was going on!
Yes but what is the solution to combine those?
I need to execute a task on the second host in the play.