Very very easy and you have many options!
You have the "when" conditional for one, which can easily key off facts
like "ansible_os_family".
- shell: /usr/bin/foo
when: "ansible_os_family == 'redhat'"
You have things like "include_vars" which can include variables based on OS
facts (1.4) at role or task level
- include_vars: "{{ansible_os_family}}.yml"
or even
- include_vars: redhat.yml
when: "ansible_os_family == 'redhat'"
You can also do this with "vars_files" at the play level:
- hosts: webservers
vars_files: "{{ ansible_os_family}}.yml"
You can have roles for each OS if you want and include a common role
dependency for common parts
(see roles chapter in docs)
You can have a standard task file and do things like:
- include: redhat.yml
when: "ansible_os_family == 'redhat'"
So, yes, lots of options!
On Mon, Dec 9, 2013 at 9:00 AM, Eric Palmer <[email protected]> wrote:
> I have a multi host deployment playbook that needs to service Nnbuntu and
> Amazon linux (RPB based) servers. Some of the common tasks are very
> specific to debian like OS and some to RPB based OS. How do I get the
> common tasks to just run what is appropriate?
>
> thanks
>
> --
> Eric Palmer
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/
--
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].
For more options, visit https://groups.google.com/groups/opt_out.