2012-04-27 03:03:14 +00:00
|
|
|
---
|
|
|
|
# this is an example of how to template a file over using some variables derived
|
|
|
|
# from the system. For instance, if you wanted to have different configuration
|
|
|
|
# templates by OS version, this is a neat way to do it. Any Ansible facts, facter facts,
|
2012-08-07 00:00:31 +00:00
|
|
|
# or ohai facts could be used to do this.
|
2012-04-27 03:03:14 +00:00
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: template a config file
|
|
|
|
action: template dest=/etc/imaginary_file.conf
|
|
|
|
first_available_file:
|
|
|
|
|
|
|
|
# first see if we have a file for this specific host
|
2012-05-08 04:09:04 +00:00
|
|
|
- /srv/whatever/${ansible_hostname}.conf
|
2012-04-27 03:03:14 +00:00
|
|
|
|
|
|
|
# next try to load something like CentOS6.2.conf
|
2012-05-08 04:09:04 +00:00
|
|
|
- /srv/whatever/${ansible_distribution}${ansible_distribution_version}.conf
|
2012-04-27 03:03:14 +00:00
|
|
|
|
|
|
|
# next see if there's a CentOS.conf
|
2012-05-08 04:09:04 +00:00
|
|
|
- /srv/whatever/${ansible_distribution}.conf
|
2012-04-27 03:03:14 +00:00
|
|
|
|
|
|
|
# finally give up and just use something generic
|
|
|
|
- /srv/whatever/default
|
|
|
|
|
|
|
|
|
|
|
|
|