I'm having a really hard time wrapping my head around how to organize my plays
and roles with Ansible.
What I have:
I have multiple Linux distros I need to support with Ansible.
Each distro has different requirements which manifest themselves as different
playbooks/roles/tasks/host groups.
What I want (i.e. this is what my brain is telling me *SHOULD* be the correct
solution for this type of situation. And yes, I *DO* have a programmer back
ground):
Call a single, general Ansible playbook that determines the
specific distro/host on client host and then executes a more specific playbook
and/or set of roles for my target host or host group.
What I don't want to do:
- I don't want to have to programmatically determine the distro of my
target host BEFORE calling Ansible so I can pass some OS-specific playbook name
to Ansible on the command line for specific host or groups of hosts.
- I don't want a SINGLE playbook which contains plays for all the OS's
I support - that's just too large and unwieldy.
Obviously, Ansible doesn't parse variables as part of include statements, but
IDEALLY, the following example is how I feel I should be solving my problem:
- hosts: all
Tasks:
- name: Determine distrbution name and release
set_fact:
myos="{{ansible_distribution|lower}}{{ansible_lsb.major_release}}"
- name: Group hosts by distro and release
action: group_by key={{myos}}
- hosts: {{myos}}
Roles:
- {{myos}}
So, how do other people solve/organize their solutions to problems similar to
this?
Thx
Chris.
--
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/BFD6B7398AEB474A9A28B39B9B5D00CB588A9696%40SRAexMBX05.sra.com.
For more options, visit https://groups.google.com/d/optout.