Files
ansible-k8s-pi-cluster/etchostsupdate.yaml

22 lines
616 B
YAML

---
- name: "generate /etc/hosts.ansible file"
template: "src=templates/etchosts.j2 dest='/etc/hosts.ansible' owner=root group=root mode=0644"
tags: etc_hosts
become: true
- name: "check if debian generated hosts file has a backup"
stat: "path=/etc/hosts.debian"
tags: etc_hosts
register: etc_hosts_debian
- name: "backup debian generated /etc/hosts"
command: "cp /etc/hosts /etc/hosts.debian"
when: etc_hosts_debian.stat.islnk is not defined
tags: etc_hosts
become: true
- name: "install /etc/hosts.ansible file"
command: "cp /etc/hosts.ansible /etc/hosts"
tags: etc_hosts
become: true