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 %}