"It doesn't work for me (unless I create a file called
roles/foobar/tasks/{{ansible_os_family}}.yml... ;-) )."So in other words, it works :) Also, public service announcement - Don't use ansible_pkg_mgr like that - it won't join mulitple package installs using with_items into single transactions. If you want to do a "when: ansible_pkg_mgr == 'apt'" that will still keep it going. On Tue, Jun 24, 2014 at 10:31 AM, Christian Thiemann <[email protected]> wrote: > It doesn't work for me (unless I create a file called > roles/foobar/tasks/{{ansible_os_family}}.yml... ;-) ). > > I abstracted away package manager things using the ansible_pkg_mgr fact: > > - module: "{{ ansible_pkg_mgr }} name=foobar,baz,foo" > > To account for OS-specific package names, you can do something like this: > > - module: "{{ ansible_pkg_mgr }} name={{ pkg_foobar }},{{ pkg_baz }},{{ > pkg_foo }}" > > The pkg_XXX variables must be defined in vars/Debian.yml and > vars/Darwin.yml, and you do this at the top of the role: > > - include_vars: '{{ ansible_os_family }}.yml' > > > > On Tuesday, June 24, 2014 3:26:28 PM UTC+2, Michael DeHaan wrote: > >> >> >> >> On Mon, Jun 23, 2014 at 3:25 PM, Nico K. <[email protected]> wrote: >> >>> Sure, but that's exactly the thing I would like to deal with within a >>> role, within a role however you can't perform the 'include' you stated in >>> your post as "ansible_os_family" doesn't seem to evaluate. >>> >> >> This is not true. >> >> Task files in roles (main.yml) can include other files. >> >> include_vars also works as a task as I have mentioned. >> > -- > 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/7712c232-8610-4b1c-a203-80eb50572477%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/7712c232-8610-4b1c-a203-80eb50572477%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/CA%2BnsWgzfbnez_Rae1P6xB_ZVoVY54PBbhSZib-n26JOfO5uVZA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
