It could easily happen that while target host was upgraded but containers left running old OS. In this case running openstack_hosts role will result in adding weird repo, like adding osbpo on Ubuntu 20.04 as it will be treated as debian due to missing more specific match. Moreover, if running setup-hosts and metal hosts were not updated to supported OS, and will fail during openstack-hosts-setup, this will not prevent containers from attempting running openstack_hosts role. Change-Id: I339bdd11a4c212cd48e9cdf659166ad0af1e84f4
115 lines
3.6 KiB
YAML
115 lines
3.6 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Set lxc containers group
|
|
hosts: "{{ container_group | default('all_containers') }}"
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Setup installation variables
|
|
include_role:
|
|
name: openstack.osa.install_defaults
|
|
defaults_from: "{{ install_method }}"
|
|
public: true
|
|
apply:
|
|
tags:
|
|
- always
|
|
tags:
|
|
- always
|
|
|
|
- name: Add hosts to dynamic inventory group
|
|
group_by:
|
|
key: lxc_containers
|
|
parents: all_lxc_containers
|
|
when:
|
|
- container_tech == 'lxc'
|
|
tags:
|
|
- always
|
|
- lxc-containers-create
|
|
|
|
- name: Gather lxc hosts facts
|
|
hosts: "{{ lxc_host_group | default('lxc_hosts') }}"
|
|
gather_facts: true
|
|
tags:
|
|
- always
|
|
|
|
- name: Create container(s)
|
|
hosts: all_lxc_containers
|
|
user: root
|
|
gather_facts: false
|
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
|
tags:
|
|
- lxc-containers-create
|
|
pre_tasks:
|
|
- name: Setup installation variables
|
|
include_role:
|
|
name: openstack.osa.install_defaults
|
|
defaults_from: "{{ install_method }}"
|
|
public: true
|
|
apply:
|
|
tags:
|
|
- always
|
|
tags:
|
|
- always
|
|
roles:
|
|
- role: "lxc_container_create"
|
|
post_tasks:
|
|
- name: Wait for container connectivity
|
|
wait_for_connection:
|
|
connect_timeout: "{{ lxc_container_wait_params.connect_timeout | default(omit) }}"
|
|
delay: "{{ lxc_container_wait_params.delay | default(omit) }}"
|
|
sleep: "{{ lxc_container_wait_params.sleep | default(omit) }}"
|
|
timeout: "{{ lxc_container_wait_params.timeout | default(omit) }}"
|
|
|
|
- name: Clear facts for new container(s)
|
|
meta: clear_facts
|
|
|
|
- name: Gather lxc containers facts
|
|
hosts: all_lxc_containers
|
|
gather_facts: true
|
|
tags:
|
|
- always
|
|
|
|
- name: Configure containers default software
|
|
hosts: all_lxc_containers
|
|
user: root
|
|
gather_facts: false
|
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
|
tags:
|
|
- lxc-containers-create
|
|
pre_tasks:
|
|
- name: Check for a supported Operating System
|
|
assert:
|
|
that:
|
|
- (ansible_facts['distribution'] == 'Debian' and ansible_facts['distribution_release'] == 'bullseye') or
|
|
(ansible_facts['distribution'] == 'Debian' and ansible_facts['distribution_release'] == 'bookworm') or
|
|
(ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_release'] == 'jammy') or
|
|
(ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '9')
|
|
msg: >
|
|
The only supported platforms for this release are Debian 11 (Bullseye), Debian 12 (Bookworm)
|
|
Ubuntu 22.04 (Jammy), CentOS 9 Stream, and Rocky Linux 9.
|
|
- name: Setup installation variables
|
|
include_role:
|
|
name: openstack.osa.install_defaults
|
|
defaults_from: "{{ install_method }}"
|
|
public: true
|
|
apply:
|
|
tags:
|
|
- always
|
|
tags:
|
|
- always
|
|
roles:
|
|
- role: "openstack_hosts"
|
|
is_container: true
|