From a32f81922e7236b5c48a82e599b69adb9d65a2b2 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 5 Nov 2017 13:40:19 -0600 Subject: [PATCH] set hostname alias early --- roles/2-common/tasks/hostname.yml | 8 ++++++++ roles/network/tasks/hosts.yml | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/2-common/tasks/hostname.yml b/roles/2-common/tasks/hostname.yml index a3ae16870..a4e400924 100644 --- a/roles/2-common/tasks/hostname.yml +++ b/roles/2-common/tasks/hostname.yml @@ -9,3 +9,11 @@ group=root mode=0644 when: is_redhat + +- name: Configure short hostname in /etc/hosts + lineinfile: dest=/etc/hosts + regexp='^127\.0\.0\.1' + line='127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}' + owner=root + group=root + mode=0644 diff --git a/roles/network/tasks/hosts.yml b/roles/network/tasks/hosts.yml index 693400c54..cf4b38278 100644 --- a/roles/network/tasks/hosts.yml +++ b/roles/network/tasks/hosts.yml @@ -1,12 +1,4 @@ #TODO: Use vars instead of hardcoded values -- name: Configure short hostname in /etc/hosts - lineinfile: dest=/etc/hosts - regexp='^127\.0\.0\.1' - line='127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}' - owner=root - group=root - mode=0644 - - name: Remove fqdn in /etc/hosts without LAN lineinfile: dest=/etc/hosts regexp='^172\.18\.96\.1'