How about keep your default variables in roles/vars/main.yml and then for 
variables that would be considered special case or overrides you put them 
elsewhere with higher precedence. For your RHEL 5 example, take a look at 
http://docs.ansible.com/playbooks_variables.html#conditional-imports and 
you could use something similar like
vars/{{  ansible_lsb.id }}_{{ ansible_lsb.major_release }}.yml  where you'd 
populate the RedHat_5.yml file with any of the variables you need 
overridden (my variable names/values might need some checking though).

Brian


On Friday, January 10, 2014 5:59:53 PM UTC-6, Adam Morris wrote:
>
> I have been building up a bunch of tasks for some standard configuration 
> items.  I have the basic tasks all working perfectly for new installs for 
> both AIX and RedHat/CentOs 6.  Now I'm testing against one of the older 
> RedHat installs that we have (RedHat 5) and having to make some changes... 
>  So far things have been going well until I got to configuring syslog.  On 
> RedHat 6 I have to modify /etc/rsyslog.conf and restart rsylogd.  On AIX it 
> is slightly different so I set variables in my current OS specific 
> group_vars files RedHat and AIX...  On RedHat 5 most of the variables work 
> perfectly for me, except /etc/rsyslog.conf becomes /etc/syslog.conf and 
> rsyslogd becomes syslogd.  So I can easily modify the variables I'm using 
> to take that into account.  But this means I need to set different 
> variables for RedHat 5 and RedHat 6.  although most of the variables are 
> the same.
>
> So how would you suggest setting variables in this case?  I can split 
> tasks out so I don't need to set variables, but then I have much larger 
> task files that contain essentially the same steps. I'm trying to reuse as 
> much as possible, but I'm at a bit of a loss here.
>
> I was wondering if I could include a RedHat variable file into a RedHat5 
> or RedHat6 variable file but I can't see how to do it.
>
> I could keep the tasks the same and have almost identical variable files 
> with minor changes for RedHat 5 and RedHat 6, but that is still not as 
> clean as I would like.
>
> Any thoughts.
>
> Adam
>
>
>

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to