From af4c8b31920650fc0323d822aa72872bc7e861e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Wed, 27 Jun 2018 07:50:30 +0200 Subject: [PATCH] see #5: verify that the hostnames are consistent --- prepare.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/prepare.yml b/prepare.yml index 2384065..cae04f9 100644 --- a/prepare.yml +++ b/prepare.yml @@ -207,6 +207,25 @@ changed_when: false tags: dns + - name: Get the machine FQDN + command: hostname -f + register: hostname_f + changed_when: false + tags: dns + + - name: Make sure the hostnames are consistent + assert: + that: + - inventory_hostname_short == discovered_hostname + - inventory_hostname == discovered_fqdn + msg: > + Your hostnames are not consistent ! Check your /etc/hosts, + /etc/sysconfig/hostname and the output of "hostnamectl status". + vars: + discovered_fqdn: '{{ hostname_f.stdout_lines[0] }}' + discovered_hostname: '{{ ansible_hostname }}' + tags: dns + - name: First, disable any repos (using subscription-manager) command: subscription-manager repos --disable="*" tags: rpm