Configure Undercloud hostname in the overcloud during upgrade.

Due to IPv6, the undercloud's container registry had to change
from an IP address in the full hostname [0]. This impacts into
the upgrade to Train as the overcloud nodes do not contain the
Undercloud's host in /etc/hosts as well as it's missing in the
registries.conf.

This patch adds two new upgrade tasks to handle:

1. container-image-prepare: Ensure that /etc/hosts file contains
an entry for the Undercloud's ctrlplane hostname. This task makes
use of the global_vars ansible parameter undercloud_hosts_entry
which contains a list of the undercloud's ctrlplan hostnames (calling
getent hosts underneath).

2. podman-baremetal-ansible: There is already an upgrade task which
takes care of reconfiguring podman during the upgrade, so this patch
simply sets up the right container unsecure registries and passes it
into the reconfiguring task. It also changes the (step | int) into
step|int as the upgrade tasks require step|int condition to decide in
which step_X playbook fall, otherwise the task will appear in every
step_X playbook.

[0] - Iac6efde9dd283906274d95c3a239b4b882ec052e

Depends-On: https://review.opendev.org/708128
Closes-Bug: #1863598
Change-Id: Ifadc797f33d759eed38c9d9274fa588b6dd19488
This commit is contained in:
Jose Luis Franco Arza 2020-02-14 16:49:10 +01:00
parent a478d4fa32
commit 495c5c9de8
2 changed files with 28 additions and 9 deletions

View File

@ -132,3 +132,12 @@ outputs:
{% endfor %}
when:
- (step | int) == 1
upgrade_tasks:
- name: Make sure the Undercloud hostname is included in /etc/hosts
when:
- step|int == 1
- undercloud_hosts_entries is defined
lineinfile:
dest: /etc/hosts
line: "{{ '{{ ' }} undercloud_hosts_entries | join('') {{ ' }}' }}"
state: present

View File

@ -136,13 +136,31 @@ outputs:
service_config_settings: {}
upgrade_tasks:
- name: Run podman install
when:
- step|int == 1
block:
- name: Set container_registry_insecure_registries fact.
set_fact:
container_registry_insecure_registries:
if:
- insecure_registry_is_empty
- []
- {get_param: DockerInsecureRegistryAddress}
- include_role:
name: tripleo-podman
tasks_from: tripleo_podman_install.yml
vars_from: "redhat.yml"
vars:
tripleo_container_registry_insecure_registries: "{{ container_registry_insecure_registries }}"
- name: system_upgrade_prepare step 2
tags:
- never
- system_upgrade
- system_upgrade_prepare
when:
- (step | int) == 2
- step|int == 2
block:
- name: Check if pcs is present
stat:
@ -163,14 +181,6 @@ outputs:
- system_upgrade
- system_upgrade_prepare
- name: Run podman install
when:
- (step | int) == 1
include_role:
name: tripleo_podman
tasks_from: tripleo_podman_install.yml
vars_from: "redhat.yml"
post_upgrade_tasks:
- name: Purge everything about docker on the host
when: