Add update action for hosts_file resource

This commit is contained in:
Łukasz Oleś 2015-09-29 12:50:50 +02:00
parent 4be37bd16a
commit 3ba878727f

View File

@ -0,0 +1,11 @@
- 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 %}