mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
882 B
YAML
29 lines
882 B
YAML
13 years ago
|
---
|
||
|
# 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,
|
||
|
# or ohai facts could be used to do this.
|
||
|
|
||
|
- 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
|
||
|
- /srv/whatever/{{ ansible_hostname }}.conf
|
||
|
|
||
|
# next try to load something like CentOS6.2.conf
|
||
|
- /srv/whatever/{{ ansible_distribution }}{{ ansible_distribution_version }}.conf
|
||
|
|
||
|
# next see if there's a CentOS.conf
|
||
|
- /srv/whatever/{{ ansible_distribution }}.conf
|
||
|
|
||
|
# finally give up and just use something generic
|
||
|
- /srv/whatever/default
|
||
|
|
||
|
|
||
|
|