I ran into the same problem and my playbooks ended up looking like this, 
not pretty to say the least. Since I primarily manage FreeBSD machines. I 
had to move quite a few of my roles to handle the singular Ubuntu system 
that exists. 

my-play.yml
---
- hosts: all
  gather_facts: yes
  tasks:
    - group_by:
        key: "{{ ansible_os_family | lower }}"

- hosts: freebsd
  sudo: yes
  gather_facts: no
  vars:
    os_type: freebsd
  roles:
    - multi-os-role

- hosts: debian
  sudo: yes
  gather_facts: no
  vars:
    os_type: debian
  roles:
    - multi-os-role

roles/multi-os-role/tasks/main.yml
---
- include: "{{ os_type }}.yml"

# other tasks that are common between OS'

if you have steps that need to be run in different places in your task like 
I did, you can make the os_type a directory and do "{{ os_type 
}}/step-one.yml" or "{{ os_type }}/step-two.yml".


-- 
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/b4def66c-0f10-4641-a9d1-e46ea4cbfb85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to