Hi Nico,

One common way to do this is to use the group_by module to make groups
based on the distribution variable, and then to use individual plays to
target those groups.

When doing this in a role, you can use include: or include_vars: to bring
in task or vars files based on the distribution variable instead.

We have a few examples of this in our integration tests, and in the Tower
installation playbook.

Thanks!

On Thu, Sep 18, 2014 at 8:42 AM, Nico K. <[email protected]> wrote:

> Hi,
>
> Given a wide-range of distribution versions how does one abstract away the
> differences?
> For example I have to deal with all Ubuntu versions between 10.04 =>
> 14.04, there are differences such as '/etc/dhcp' vs '/etc/dhcp3' and so on.
> The 'group_by' statement here doesn't really help since that would result
> in having to create ~8 configurations.
>
> What I would like to do is in an existing group_vars file say:
>
> dhcp_dir: /etc/dhcp3
> when: ansible_distribution_version|compare .. otherwise ..
>
> Or otherwise do something like this in a task?  Perhaps using 'set_fact'?
>
> Any ideas?
>
> Nico
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/991dfe1c-8b2f-4892-9159-3c6caf9b70d9%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/991dfe1c-8b2f-4892-9159-3c6caf9b70d9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMFyvFgG4KLVOK2%3DmS7e7d5JHEi9MfqYDPg6xXeMYOG6AkupLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to