I would gladly get some advice here.
First, Ansible is so great - I replaced my Puppet proviosning for our UNIX hosts in a few days and everything is working so well and easy to maintain.
We support AIX, HP-UX, Solaris and Linux (RedHat, Suse, Ubuntu) so I have a commands variance between OS and also between OS variants.
Windows clients support is so so so so asked around here (simple zip extracting module, commands execution)
I use roles and at the moment I took all different shared roles parameters and shell command paths into param files at playbooks/vars/AIX.yml, HP-UX.yml and so…
For Linux - I have Linux.yml, Redhat_7.yml and Suse.yml for example as some commands are different between RHEL 5-6, RHEL 7, Ubuntu and Suse and some are the same.
In my playbook I use the vars_files feature as I found in the docs example below to match for the specific OS version or OS type or Linux in general:
vars_files:
- "vars/common.yml"
- [ "vars/{{ ansible_os_family }}.yml", "vars/os_defaults.yml" ]
It works well but introduces duplication as the first matching file is selected and I need the non different parameters inside this file too…
First question, in the above example, common.yml parameter X will get overidden by {{ansible_os_family}}.yml defined parameter X?
Second question, I would like to separate parameters of OS commands to one file, Application X to another and so…
I get a real big section of this vars_files that is very ugly to copy paste for each playbook…
Can you suggest a better way to handle this please?
Thanks