From 3ba878727ff248710cdc398d310ea0c581035542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Tue, 29 Sep 2015 12:50:50 +0200 Subject: [PATCH] Add update action for hosts_file resource --- resources/hosts_file/actions/update.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 resources/hosts_file/actions/update.yaml diff --git a/resources/hosts_file/actions/update.yaml b/resources/hosts_file/actions/update.yaml new file mode 100644 index 0000000..8ad5f23 --- /dev/null +++ b/resources/hosts_file/actions/update.yaml @@ -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 %}