undercloud-setup: Introduce tripleo_set_unique_hostname variable

In hostname playbook, add a task to modify /etc/hosts.
tripleo_set_unique_hostname is a new boolean which if set to true,
will add a line to /etc/hosts with an unique hostname
( {{ ansible_hostname }}-unique ) which will resolve the first IPv4
address found in the inventory.

It is useful to reproduce a deployment where the operator is using
hostnames to create SSL certificates and deploy the undecloud with the
public host being an hostname/fqdn and not an IP address.

Related-Bug: #1763776
Change-Id: I6425499e5d248e6cb2285f14dd9c6e716122b90b
This commit is contained in:
Emilien Macchi 2019-05-09 10:59:18 +02:00
parent cdbf6f9319
commit 9cc7489cca
2 changed files with 11 additions and 0 deletions

View File

@ -41,3 +41,4 @@ undercloud_ara_version: 0.15.0
undercloud_ara: false
install_atop: true
atop_command: atop -R -w /var/log/atop.bin
tripleo_set_unique_hostname: false

View File

@ -16,6 +16,16 @@
{{ working_dir }}/hostname.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/hostname.sh.log
become: true
# https://launchpad.net/bugs/1763776
- name: Add a unique hostname to /etc/hosts resolved to the first IPv4 available
become: true
lineinfile:
dest: /etc/hosts
state: present
insertafter: EOF
line: "{{ ansible_all_ipv4_addresses | first }} {{ ansible_hostname }}-unique"
when: tripleo_set_unique_hostname|default(false)|bool
# for undercloud containers only, starting from Rocky.
- name: Override containerized undercloud CI hostname for tripleo client
when: