Hi,
I've just started working with Ansible and first want to say, "Nice
work Michael!". I was able to understand the concepts and get a
'hello world' example running in hours. I've been looking a Puppet/
Chef off and on over the last year and never really "got it".
I would like to create a task (or playbook) that installs EPEL on a
RHEL/CentOS/SciLinux systems. So, first I need to ensure I'm on an
EPEL compatible OS. I tried (incomplete)
Quoting can be fun with "only_if" which is why the "when_" forms
exist, but the easiest way to do it is really to use "group slicing"
using the only_if module.
It is more idiomatic and keeps you from writing code, and makes
playbooks more readable.
Remember that a playbook is a list of plays, so you can have one play
that targets everything, one that targets some specific thing,
followed up by another that targets everything.
Thus, in many cases, you can avoid using conditionals this way.
http://ansible.cc/docs/bestpractices.html#operating-system-and-distribution-variance
Thus you could easily make groups for
${ansible_distribution}-${ansible_distribution_version}
and do:
hosts: CentOS-5.4:CentOS-5.5
For instance, to target just hosts running CentOS-5.4 and 5.5
I don't believe we imported the "re" module in the right scope yet to
do regular expressions in the conditionals, but I'll have to check on
that.