Hello Dan Vaida,

Dan Vaida wrote:
> Using that approach, the more platforms your hosts will sport, the
> more "skipping" you'll see in your playbook runs. I'd use the
> group_by module: http://docs.ansible.com/group_by_module.html and
> use the ansible_distribution fact as a key. Hope that helps.

thank you for your answer. The group_by - way to do this is also an
option for me but with that I can not encapsulate (and ship)
everything in a single role anymore (galaxy) and the OS split happens
in the playbook (instead of inside the role).

Is it uncommon to have a single role support multiple platforms with
such platform dependent includes as it was my intention?
I currently have 3 target platforms, in the future it might be four -
but certainly not more.

..but after all I still don't know how to assign platform dependent
vars within role/default/main.yml yet (my original question).


Dan Vaida wrote:
> I think your other thread to which I replied is related to this as
well.

That is correct - so I merged them into one thread for simplicity.

> Perhaps this example would be more helpful:
https://github.com/danvaida/Ansible-Berlin-Meetup/blob/master/ansible-intro-examples/ghost.yml

Ok, after some additional playing I got it, the trick is to specify
'-hosts:' again after running the group_by module.

recap:
NOT working
-------------
- hosts: all
  - name: create groups based on package manager
    group_by: key="{{ansible_pkg_mgr}}"

  roles:
   - foorole
   #foorole is not able to access vars defined in group_vars/apt /yum
 -----------

working
-------------
- hosts: all
  - name: create groups based on package manager
    group_by: key="{{ansible_pkg_mgr}}"

- hosts: all
  gather_facts: False
  roles:
   - foorole
  # this time foorole can access stuff defined in group_vars/*
-----------

thank you,
Nusenu





-- 
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/54E91B7F.1090608%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to