Ubuntu: simplify OS distro selection

Adds a new 'os_distribution' variable which can be used to select the OS
distribution, with sensible defaults for other variables. The default
value is 'centos'.

This patch changes the default value for the '*_bootstrap_user'
variables from using the $USER environment variable to using fixed
defaults equal to the os_distribution variable. This aligns with the
standard user configured in most cloud images, and images created via
DIB.

Note that we are continuing to use a CentOS based IPA image, since we
have been unable to get IPA to build for Ubuntu.

Depends-On: https://review.opendev.org/c/openstack/kayobe-config-dev/+/788234

Change-Id: I9e10239f58fe209867116fa2e10f1ce74220b966
Story: 2004960
Task: 42323
This commit is contained in:
Mark Goddard 2021-04-21 12:18:11 +01:00
parent 7411e624de
commit d6aa4ea16e
19 changed files with 77 additions and 30 deletions

View File

@ -18,15 +18,18 @@ kolla_bifrost_firewalld_internal_zone: trusted
###############################################################################
# Diskimage-builder configuration.
# DIB base OS element.
kolla_bifrost_dib_os_element: "centos"
# DIB base OS element. Default is {{ os_distribution }}.
kolla_bifrost_dib_os_element: "{{ os_distribution }}"
# DIB image OS release.
kolla_bifrost_dib_os_release: "8"
# DIB image OS release. Default is "focal" when os_distribution is "ubuntu", or
# "8" otherwise.
kolla_bifrost_dib_os_release: "{{ 'focal' if os_distribution == 'ubuntu' else '8' }}"
# List of default DIB elements.
# List of default DIB elements. Default is ["disable-selinux",
# "enable-serial-console", "vm"] when os_distribution is "centos", or
# ["enable-serial-console", "vm"] otherwise.
kolla_bifrost_dib_elements_default:
- "disable-selinux"
- "{% if os_distribution == 'centos' %}disable-selinux{% endif %}"
- "enable-serial-console"
- "vm"
@ -34,7 +37,7 @@ kolla_bifrost_dib_elements_default:
kolla_bifrost_dib_elements_extra: []
# List of all DIB elements.
kolla_bifrost_dib_elements: "{{ kolla_bifrost_dib_elements_default + kolla_bifrost_dib_elements_extra }}"
kolla_bifrost_dib_elements: "{{ kolla_bifrost_dib_elements_default | select | list + kolla_bifrost_dib_elements_extra }}"
# DIB init element.
kolla_bifrost_dib_init_element: "cloud-init-datasources"

View File

@ -3,8 +3,8 @@
# Compute node configuration.
# User with which to access the computes via SSH during bootstrap, in order
# to setup the Kayobe user account.
compute_bootstrap_user: "{{ lookup('env', 'USER') }}"
# to setup the Kayobe user account. Default is {{ os_distribution }}.
compute_bootstrap_user: "{{ os_distribution }}"
###############################################################################
# Compute network interface configuration.

View File

@ -3,8 +3,8 @@
# Controller node configuration.
# User with which to access the controllers via SSH during bootstrap, in order
# to setup the Kayobe user account.
controller_bootstrap_user: "{{ lookup('env', 'USER') }}"
# to setup the Kayobe user account. Default is {{ os_distribution }}.
controller_bootstrap_user: "{{ os_distribution }}"
###############################################################################
# Controller network interface configuration.

View File

@ -40,3 +40,10 @@ virtualenv_path: "{{ base_path ~ '/venvs' }}"
# User with which to access remote hosts. This user will be created if it does
# not exist.
kayobe_ansible_user: "stack"
###############################################################################
# OS distribution.
# OS distribution name. Valid options are "centos", "ubuntu". Default is
# "centos".
os_distribution: "centos"

View File

@ -52,8 +52,9 @@ kolla_node_custom_config_path: "{{ kolla_config_path }}/config"
###############################################################################
# Kolla configuration.
# Kolla base container image distribution.
kolla_base_distro: "centos"
# Kolla base container image distribution. Options are "centos", "debian",
# "ubuntu". Default is {{ os_distribution }}.
kolla_base_distro: "{{ os_distribution }}"
# Kolla container image type: binary or source.
kolla_install_type: "binary"

View File

@ -3,8 +3,8 @@
# Seed node configuration.
# User with which to access the seed via SSH during bootstrap, in order to
# setup the Kayobe user account.
seed_bootstrap_user: "{{ lookup('env', 'USER') }}"
# setup the Kayobe user account. Default is {{ os_distribution }}.
seed_bootstrap_user: "{{ os_distribution }}"
###############################################################################
# Seed network interface configuration.

View File

@ -3,8 +3,8 @@
# Seed hypervisor node configuration.
# User with which to access the seed hypervisor via SSH during bootstrap, in
# order to setup the Kayobe user account.
seed_hypervisor_bootstrap_user: "{{ lookup('env', 'USER') }}"
# order to setup the Kayobe user account. Default is {{ os_distribution }}.
seed_hypervisor_bootstrap_user: "{{ os_distribution }}"
###############################################################################
# Seed hypervisor network interface configuration.

View File

@ -40,8 +40,17 @@ seed_vm_root_capacity: 50G
# Format of the seed VM root volume.
seed_vm_root_format: qcow2
# Base image for the seed VM root volume.
seed_vm_root_image: "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2"
# Base image for the seed VM root volume. Default is
# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
# when os_distribution is "ubuntu", or
# "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2"
# otherwise.
seed_vm_root_image: >-
{%- if os_distribution == 'ubuntu' %}
https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
{%- else -%}
https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2
{%- endif %}
# Capacity of the seed VM data volume.
seed_vm_data_capacity: 100G

View File

@ -3,8 +3,8 @@
# Storage node configuration.
# User with which to access the storages via SSH during bootstrap, in order
# to setup the Kayobe user account.
storage_bootstrap_user: "{{ lookup('env', 'USER') }}"
# to setup the Kayobe user account. Default is {{ os_distribution }}.
storage_bootstrap_user: "{{ os_distribution }}"
###############################################################################
# Storage network interface configuration.

View File

@ -18,14 +18,16 @@
###############################################################################
# Diskimage-builder configuration.
# DIB base OS element. Default is "centos".
# DIB base OS element. Default is {{ os_distribution }}.
#kolla_bifrost_dib_os_element:
# DIB image OS release. Default is "8".
# DIB image OS release. Default is "focal" when os_distribution is "ubuntu", or
# "8" otherwise.
#kolla_bifrost_dib_os_release:
# List of default DIB elements. Default is ["disable-selinux",
# "enable-serial-console", "vm"].
# "enable-serial-console", "vm"] when os_distribution is "centos", or
# ["enable-serial-console", "vm"] otherwise.
#kolla_bifrost_dib_elements_default:
# List of additional DIB elements. Default is none.

View File

@ -3,7 +3,7 @@
# Compute node configuration.
# User with which to access the computes via SSH during bootstrap, in order
# to setup the Kayobe user account.
# to setup the Kayobe user account. Default is {{ os_distribution }}.
#compute_bootstrap_user:
###############################################################################

View File

@ -3,7 +3,7 @@
# Controller node configuration.
# User with which to access the controllers via SSH during bootstrap, in order
# to setup the Kayobe user account.
# to setup the Kayobe user account. Default is {{ os_distribution }}.
#controller_bootstrap_user:
###############################################################################

View File

@ -42,6 +42,13 @@
# not exist.
#kayobe_ansible_user:
###############################################################################
# OS distribution.
# OS distribution name. Valid options are "centos", "ubuntu". Default is
# "centos".
#os_distribution:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -61,7 +61,8 @@
###############################################################################
# Kolla configuration.
# Kolla base container image distribution. Default is 'centos'.
# Kolla base container image distribution. Options are "centos", "debian",
# "ubuntu". Default is {{ os_distribution }}.
#kolla_base_distro:
# Kolla container image type: binary or source. Default is 'binary'.

View File

@ -3,7 +3,7 @@
# Seed hypervisor node configuration.
# User with which to access the seed hypervisor via SSH during bootstrap, in
# order to setup the Kayobe user account.
# order to setup the Kayobe user account. Default is {{ os_distribution }}.
#seed_hypervisor_bootstrap_user:
###############################################################################

View File

@ -24,7 +24,10 @@
#seed_vm_root_format:
# Base image for the seed VM root volume. Default is
# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
# when os_distribution is "ubuntu", or
# "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2"
# otherwise.
#seed_vm_root_image:
# Capacity of the seed VM data volume.

View File

@ -3,7 +3,7 @@
# Seed node configuration.
# User with which to access the seed via SSH during bootstrap, in order to
# setup the Kayobe user account.
# setup the Kayobe user account. Default is {{ os_distribution }}.
#seed_bootstrap_user:
###############################################################################

View File

@ -3,7 +3,7 @@
# Storage node configuration.
# User with which to access the storages via SSH during bootstrap, in order
# to setup the Kayobe user account.
# to setup the Kayobe user account. Default is {{ os_distribution }}.
#storage_bootstrap_user:
###############################################################################

View File

@ -0,0 +1,14 @@
---
features:
- |
Adds an ``os_distribution`` variable in ``etc/kayobe/globals.yml``, with a
default value of ``centos``. The variable can also be set to ``ubuntu``,
and sets sensible default values for other variables.
upgrade:
- |
Modifies the default value of ``controller_bootstrap_user``,
``compute_bootstrap_user``, ``seed_bootstrap_user``,
``seed_hypervisor_bootstrap_user`` and ``storage_bootstrap_user`` from
using the ``$USER`` environment variable of the Ansible control host to
``os_distribution``. This provides a more predictable default that does not
depend on the Ansible execution environment.