On Tue, 24 Mar 2015, Vince Skahan wrote:
On Tuesday, March 24, 2015 at 6:46:27 AM UTC-7, Jonathan Davila wrote:
You could try to variablize the values of the module parameters into
os-specific vars files and then do conditional include statements based on
the os.
Where you would have files named like debian-7.yml, etc. And within those
files you would have serial_regex/replace defined along with any other vars.
Does that help?
Notionally yes, but ansible doesn't seem to like variables in - include:
statements.
Does ansible do 'include' before 'gather_facts' perhaps ?????
If so, that would be a pretty major bug/misfeature to me...
I haven't tested your example, but what I usually do is something like:
tasks:
- action: group_by key={{ ansible_distribution }}-{{
ansible_distribution_major }}
and have a a group_vars file for each group:
group_vars/debian-7
group_vars/redhat-6
This will automatically pull variables from the matching group_vars file.
In fact, in large/complex environments my inventory script has this kind
of functionality included so that it has all the needed variables
and groups available for every playbook and play from the very start.
--
Dag