solar/resources/hosts_file/actions/run.yaml
2015-09-16 11:49:51 +02:00

12 lines
304 B
YAML

- hosts: [{{host}}]
sudo: yes
tasks:
{% for val in hosts %}
- name: Create hosts entries for {{val['name']}} => {{val['ip']}}
lineinfile:
dest: /etc/hosts
regexp: '.*{{val['name']}}$'
line: '{{val['ip']}} {{val['name']}}'
state: present
{% endfor %}