Check for a FQDN hostname in instack-install-undercloud
A FQDN hostname needs to be set. The $HOSTNAME environment variable should also match the defined FQDN hostname. rabbitmq-env makes use of $HOSTNAME and if it does not match the FQDN hostname, rabbitmq-server will fail to start for various reasons. For the virt setup, handle setting the FQDN hostname automatically as instack.localdomain. Change-Id: Id3339702ed4db4cd593ef1a70249f29f79059c6f
This commit is contained in:
parent
c93423c5d6
commit
2897a07827
|
@ -18,12 +18,27 @@ Installing Undercloud
|
|||
|
||||
su - stack
|
||||
|
||||
.. note::
|
||||
Ensure that there is an entry for the system's full hostname in /etc/
|
||||
hosts. For example, if the system is named *myhost.mydomain*, /etc/hosts
|
||||
should have an entry like::
|
||||
.. admonition:: Baremetal
|
||||
:class: baremetal
|
||||
|
||||
127.0.0.1 myhost.mydomain
|
||||
.. note:: Ensure that there is a FQDN hostname set and that the $HOSTNAME
|
||||
environment variable matches that value.
|
||||
|
||||
Use ``hostnamectl`` to set a hostname if needed::
|
||||
|
||||
sudo hostnamectl set-hostname myhost.mydomain
|
||||
sudo hostnamectl set-hostname --transient myhost.mydomain
|
||||
export HOSTNAME=myhost.mydomain
|
||||
|
||||
An entry for the system's FQDN hostname is also needed in /etc/hosts.
|
||||
For example, if the system is named *myhost.mydomain*, /etc/hosts should have
|
||||
an entry like::
|
||||
|
||||
127.0.0.1 myhost.mydomain
|
||||
|
||||
Copy in the sample answers file and edit it to reflect your environment::
|
||||
|
||||
cp /usr/share/instack-undercloud/instack.answers.sample ~/instack.answers
|
||||
|
||||
|
||||
#. Download and execute the instack-undercloud setup script which will enable
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
echo "$UNDERCLOUD_VM_NAME.localdomain" > /etc/hostname
|
||||
echo "127.0.0.1 $UNDERCLOUD_VM_NAME $UNDERCLOUD_VM_NAME.localdomain" >> /etc/hosts
|
|
@ -10,6 +10,31 @@ exec 2>&1
|
|||
|
||||
echo "Running $0"
|
||||
|
||||
echo "Checking for a FQDN hostname..."
|
||||
detected_static_hostname=$(sudo hostnamectl --static)
|
||||
echo "static hostname detected as...$detected_static_hostname"
|
||||
detected_transient_hostname=$(sudo hostnamectl --transient)
|
||||
echo "transient hostname detected as...$detected_transient_hostname"
|
||||
echo "\$HOSTNAME detected as...$HOSTNAME"
|
||||
|
||||
if [ ! "$detected_static_hostname" = "$detected_transient_hostname" ]; then
|
||||
echo "static hostname does not match transient hostname"
|
||||
echo "Use hostnamectl to set matching hostnames."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$detected_static_hostname" = "$HOSTNAME" ]; then
|
||||
echo "static hostname does not match \$HOSTNAME"
|
||||
echo "Set \$HOSTNAME to match or relogin so $HOSTNAME is redefined."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -E "\s+$detected_static_hostname(\s|$)+" /etc/hosts; then
|
||||
echo "static hostname not set in /etc/hosts"
|
||||
echo "Please add a line to /etc/hosts for the static hostname."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We must do this until tripleo-puppet-elements is packaged
|
||||
export DIB_INSTALLTYPE_puppet_modules=source
|
||||
# Commit 9970cc6550735370666553cb043656bb945bef7b to puppetlabs-concat is
|
||||
|
|
Loading…
Reference in New Issue