library/roles/deb-set-hostname/tasks/main.yml: Configure /etc/hosts if needed.

This commit is contained in:
Andrea Dell'Amico 2017-02-23 22:22:22 +01:00
parent 62b9b9582d
commit ae00302e88
1 changed files with 4 additions and 0 deletions

View File

@ -4,3 +4,7 @@
when: hostname is defined
tags: bootstrap
- name: Add the hostname to /etc/hosts
shell: grep -v {{ ansible_default_ipv4.address }} /etc/hosts > /etc/hosts.tmp ; echo "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}" >> /etc/hosts.tmp ; /bin/mv /etc/hosts.tmp /etc/hosts
when: hostname is defined
tags: bootstrap