Will this work ok if I use apt: module directly instead? For different
package lists in Debian and Ubuntu, for example.
19 cze 2014 18:49 "Michael DeHaan" <mich...@ansible.com> napisaƂ(a):

> Never do this, ansible_pkg_mgr does not allow the with_items block to be
> grouped into a single yum/apt transaction, which results in much slower
> package installations.
>
> I understand why it's appealing, but really don't ... you'll also find
> that the yum and apt modules have different options you may want to use
> from time to time anyway.
>
>
> On Thu, Jun 19, 2014 at 7:47 AM, Maciej Delmanowski <dryb...@gmail.com>
> wrote:
>
>> How about this solution?
>>
>> In `defaults/main.yml`:
>>
>>     java_distribution_packages:
>>       Debian: [ 'openjdk-7', 'java-stuff' ]
>>       RefHat: [ 'java-runtime-7', 'other-stuff' ]
>>
>> And then, in `tasks/main.yml`:
>>
>>     - {{ ansible_pkg_mgr }}: name={{ item }} state=latest
>>       witn_items: java_distribution_packages[ansible_os_family]
>>
>> I think that should work fine and let you override
>> java_distribution_packages in inventory.
>>
>> Maciej
>>
>>
>> 2014-06-19 14:40 GMT+02:00 Jeff Geerling <geerling...@gmail.com>:
>>
>> The technique I usually use for making a role work cross-distro is to do
>>> two things:
>>>
>>> *For variables*: Include a variables file named {{ ansible_os_family
>>> }}.yml (then stick 'Debian.yml' and 'RedHat.yml', etc. into the role's vars
>>> folder.
>>>
>>> *For tasks*: Add "when: ansible_os_family == 'Distribution'" to the
>>> task (where 'Distribution' is Debian, RedHat, etc.).
>>>
>>> This presents an issue; for normal variables that I want to let role
>>> users override easily, I put the variables in the roles 'defaults/main.yml'
>>> file. But for distribution-specific variables (for example, "java_packages"
>>> in my Java role <https://github.com/geerlingguy/ansible-role-java>), I
>>> have to put the distro-specific vars include files in the main 'vars'
>>> folder, so those variables have higher precedence than, say, group_vars.
>>>
>>> I've bumped into this a few times, but could usually find other ways of
>>> getting the variable I want to take hold. For some users, it's not
>>> possible, thus I have bugs like: Openjdk-7 cannot be installed
>>> <https://github.com/geerlingguy/ansible-role-java/issues/1>.
>>>
>>> What are some possible fixes/other ways to do this?
>>>
>>> I could set up a variable for each distro (like "java_redhat_packages"
>>> and "java_debian_packages", but in some roles, where 5-10 of these would be
>>> needed, I fear maintainability and simplicity would be sacrificed for
>>> variable overridability...
>>>
>>> --
>>> 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 ansible-project+unsubscr...@googlegroups.com.
>>> To post to this group, send email to ansible-project@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/d8e90023-a27d-4e71-962e-e8919aadfa83%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/d8e90023-a27d-4e71-962e-e8919aadfa83%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 ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEnKK1yksi6J2QNjDYXbh1iwMwSHgxx1nLjKmOEpEVY2oic78w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEnKK1yksi6J2QNjDYXbh1iwMwSHgxx1nLjKmOEpEVY2oic78w%40mail.gmail.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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgw0pa_HG2p%3DCjJWd1Q-iWy%3D6UDfdoiFRJNnd1hHw2aRHg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgw0pa_HG2p%3DCjJWd1Q-iWy%3D6UDfdoiFRJNnd1hHw2aRHg%40mail.gmail.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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEnKK1zX3KMkvEVxFHCpNe_UPsU%2BbYfuPAZVYstWDDb-kF77Hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to