2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Set the hostname
|
|
|
|
hostname: name={{ hostname }}
|
|
|
|
when: hostname is defined
|
|
|
|
tags: bootstrap
|
|
|
|
|
2017-02-23 22:22:22 +01:00
|
|
|
- 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
|