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] <javascript:>
> > 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.
For more options, visit https://groups.google.com/d/optout.