2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Set the hostname
|
|
|
|
hostname: name={{ hostname }}
|
|
|
|
when: hostname is defined
|
2018-02-02 11:07:29 +01:00
|
|
|
tags: [ 'bootstrap', 'set_hostname' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2017-02-23 22:22:22 +01:00
|
|
|
- name: Add the hostname to /etc/hosts
|
2017-09-12 15:33:56 +02:00
|
|
|
shell: grep -v {{ ansible_default_ipv4.address }} /etc/hosts > /etc/hosts.tmp ; echo "{{ ansible_default_ipv4.address }} {{ hostname }} {{ ansible_hostname }}" >> /etc/hosts.tmp ; /bin/mv /etc/hosts.tmp /etc/hosts
|
2018-09-05 17:02:03 +02:00
|
|
|
when:
|
|
|
|
- hostname is defined
|
|
|
|
- ansible_virtualization_type == 'xen'
|
2018-02-02 11:07:29 +01:00
|
|
|
tags: [ 'bootstrap', 'set_hostname' ]
|