Hi,
I'm facing issue, which how the ansible is running tasks. It's internal
behaviour of ansible core II donot have answer on users forum.
I'm writing mostly multi os/version enabled roles. See may template role
on github.I will user it to describe the problem I have.
https://github.com/hudecof/sensible_test
managed hosts:
- debian 7, 8
- ubuntu 14.04, 16.04
- centos 6,7
- rhel 6,7
The main idea is in the tasks/main.yml and in vars/os-XXXXX.yml.
Inthe VARS file there is a list of tasks file to be included. They vary
based on the OS, in this case for debian/ubuntu and centos/rhel are the
same.
The order needs to be keep, the task are dependent in must of the case.
When you run the role, the out put is in logs/full_run.log
https://github.com/hudecof/sensible_test/blob/master/logs/full_run.log
As you can see, the task execution is
- task 01 for debian
- task 02 common
- task 01 for centos
And there is the problem, I need to run the 'task 01 centos' before the
'taks 02', the order of the tasks is not the same as specified in
vars/os-Centos.yml or vars/os-RedHat.yml.
If you run it only against Debian only or CentOs only servers, the order
is OK.
The problem is, how is ansible handling the tasks includes.
best regards
Peter Hudec