Hi,

You are overwriting test_tasks variable. Variables in ansible re in one
global namespace. Therefore debian included version will probably overwrite
centos one.

My general suggestion would be to avoid such techniques as it will make
role much harder to understand. If role would rather create role per os
family. Other way could be to use multile includes.

On Apr 10, 2017 10:04 PM, "Peter Hudec" <phu...@cnc.sk> wrote:

> 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
> --
> *Peter Hudec*
> Infraštruktúrny architekt
> phu...@cnc.sk <mailto:phu...@cnc.sk>
>
> *CNC, a.s.*
> Borská 6, 841 04 Bratislava
> Recepcia: +421 2 35 000 100
>
> Mobil:+421 905 997 203
> *www.cnc.sk* <http:///www.cnc.sk>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to