Use /tmp for generate-hosts, and remove the folders when it is done

master
Zachary Seguin 6 years ago
parent df4eaa1ba8
commit bca8bad326
  1. 11
      roles/generate-hosts/tasks/main.yml

@ -2,12 +2,17 @@
- name: update hosts
connection: local
become: no
git: repo=~git/public/hosts.git dest=generate-hosts-{{ ansible_hostname }}
git: repo=~git/public/hosts.git dest=/tmp/generate-hosts-{{ ansible_hostname }}
- name: generate hosts file
connection: local
become: no
shell: generate-hosts-{{ ansible_hostname }}/generate-hosts.py < generate-hosts-{{ ansible_hostname }}/hosts.in > generate-hosts-{{ ansible_hostname }}/hosts
shell: /tmp/generate-hosts-{{ ansible_hostname }}/generate-hosts.py < /tmp/generate-hosts-{{ ansible_hostname }}/hosts.in > /tmp/generate-hosts-{{ ansible_hostname }}/hosts
- name: copy hosts file
copy: src=generate-hosts-{{ ansible_hostname }}/hosts dest=/etc/hosts backup=yes
copy: src=/tmp/generate-hosts-{{ ansible_hostname }}/hosts dest=/etc/hosts backup=yes
- name: cleanup generate-hosts
connection: local
become: no
file: path=/tmp/generate-hosts-{{ ansible_hostname }} state=absent

Loading…
Cancel
Save