tripleo-quickstart-extras/roles/undercloud-setup/templates/hostname.sh.j2
Dan Prince 86ceb2b356 Fix the undercloud-containers job
The undercloud installer (when using --heat-native) can configure
its own docker settings.

Also, use yum install to add required packages until we can get these
installed via RDO.

Ensure the /etc/hosts file is cleaned out for the undercloud deployment

Co-Authored-By: Wes Hayutin <weshayutin@gmail.com>

Depends-On: I2d569eef136254dc81bdee93a7869fd361a8400d
Change-Id: I583128ef8fb986a08ea372344ed072e506b97d89
2017-11-17 17:01:21 -05:00

32 lines
804 B
Django/Jinja

#!/usr/bin/env bash
set -eux
### --start_docs
## Adjust the hostname as necessary (usually on the undercloud)
## Note.. run this script with sudo or root
## ============================================================
{% if hostname_correction|bool %}
## * Correct the host's transient hostname to a static one
## ::
hostnamectl set-hostname --transient $(hostnamectl --static)
{% elif step_set_undercloud_hostname|bool %}
## * Set the host's transient and static hostnames
## ::
hostnamectl set-hostname --transient {{ undercloud_hostname }}
hostnamectl set-hostname --static {{ undercloud_hostname }}
{% endif %}
## * Sanitize the /etc/hosts for duplicate entries
## ::
cp /etc/hosts /etc/hosts.bak
awk '!seen[$0]++' /etc/hosts > /etc/hosts.new
mv -f /etc/hosts.new /etc/hosts
### --stop_docs