
For couple of cycles we include our systemd-related roles in openstack_hosts role, with purpose of operators being able to configure their nodes before any actuall service or infra role will kick in. This should also provide ability to configure networking for LXC and setup overall. So with moving systemd role includes during AIO setup to variables which leverage openstack_hosts behavior we achieve multiple goals at once: - Reduce amount of intersecting logic in AIO bootstrap - Add testing for openstack_hosts section and ensure it's functional - Improve transparency for deployers and ability to see and change network configuration, as it will be templated as variables file instead of be directly applied. As a consequence, we need to access host by it's already established IP address, rather then one defined by us. However, we already require having `bootstrap_host_public_address` and rely on it heavily, so it should not bring much regressions with the approach. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-haproxy_server/+/953670 Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/954316 Change-Id: Ib688a5a758ec5ebbd0ebafdcaf2b27aeecdd9aba Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
272 lines
7.4 KiB
YAML
272 lines
7.4 KiB
YAML
---
|
|
# Copyright 2015, 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.
|
|
|
|
# Identify AIO builds in the git user-agent
|
|
- name: Include prepare_git_useragent tasks
|
|
ansible.builtin.include_tasks: prepare_git_useragent.yml
|
|
|
|
# Attempt data device detection if enabled
|
|
- name: Include detect_data_disk_device tasks
|
|
ansible.builtin.include_tasks: detect_data_disk_device.yml
|
|
when:
|
|
- bootstrap_host_data_disk_device is none
|
|
- bootstrap_host_data_disk_device_detect | bool
|
|
|
|
# Before we do anything, check the minimum requirements
|
|
- name: Import check-requirements tasks
|
|
ansible.builtin.import_tasks: check-requirements.yml
|
|
tags:
|
|
- check-requirements
|
|
|
|
# We will look for the most specific variable files first and eventually
|
|
# end up with the least-specific files.
|
|
- name: Gather variables for each operating system
|
|
ansible.builtin.include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
|
|
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
|
|
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
|
|
- "{{ ansible_facts['distribution'] | lower }}.yml"
|
|
- "{{ ansible_facts['os_family'] | lower }}.yml"
|
|
tags:
|
|
- always
|
|
|
|
- name: Gather nodepool variables
|
|
ansible.builtin.import_tasks: gather_nodepool_vars.yml
|
|
tags:
|
|
- always
|
|
|
|
- name: Create the required directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
with_items:
|
|
- "/openstack"
|
|
tags:
|
|
- create-directories
|
|
|
|
- name: Import install_packages tasks
|
|
ansible.builtin.import_tasks: install_packages.yml
|
|
tags:
|
|
- install-packages
|
|
|
|
# Prepare the data disk, if one is provided
|
|
- name: Include prepare_data_disk tasks
|
|
ansible.builtin.include_tasks: prepare_data_disk.yml
|
|
when:
|
|
- bootstrap_host_data_disk_device != None
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-data-disk
|
|
tags:
|
|
- always
|
|
|
|
# Symlink host repos to /openstack/src to match the lxc continer bind mount
|
|
# NOTE(jrosser) this must happen *after* prepare_data_disk as /openstack may remounted
|
|
- name: Use on-disk repos for openstack services in CI
|
|
block:
|
|
- name: Symlink /openstack/src to /home/zuul/src
|
|
ansible.builtin.file:
|
|
src: "{{ lookup('env', 'ZUUL_SRC_PATH') }}"
|
|
dest: '/openstack/src'
|
|
state: link
|
|
|
|
- name: Create override for zuul git server to local repos
|
|
ansible.builtin.copy:
|
|
content: |
|
|
openstack_opendev_base_url: "file:///openstack/src/opendev.org"
|
|
dest: "/etc/openstack_deploy/user_variables_zuulrepos.yml"
|
|
mode: "0644"
|
|
|
|
when:
|
|
- "lookup('env', 'ZUUL_SRC_PATH') | length > 0"
|
|
|
|
# Prepare the swap space loopback disk
|
|
# This is only necessary if there isn't swap already
|
|
- name: Include prepare_loopback_swap
|
|
ansible.builtin.include_tasks: prepare_loopback_swap.yml
|
|
when:
|
|
- bootstrap_host_loopback_swap | bool
|
|
- ansible_facts['swaptotal_mb'] < 1
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the zfs storage loopback disk
|
|
- name: Include prepare_loopback_zfs tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_zfs.yml
|
|
when:
|
|
- bootstrap_host_loopback_zfs | bool
|
|
- bootstrap_host_data_disk_device == None
|
|
- _lxc_container_backing_store == 'zfs'
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the btrfs storage loopback disk
|
|
- name: Include prepare_loopback_btrfs tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_btrfs.yml
|
|
when:
|
|
- bootstrap_host_loopback_btrfs | bool
|
|
- bootstrap_host_data_disk_device == None
|
|
- _lxc_container_backing_store == 'btrfs'
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the Cinder LVM VG loopback disk
|
|
# This is only necessary if bootstrap_host_loopback_cinder is set to yes
|
|
- name: Include prepare_loopback_cinder tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_cinder.yml
|
|
when:
|
|
- bootstrap_host_loopback_cinder | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the Nova instance storage loopback disk
|
|
- name: Include prepare_loopback_nova tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_nova.yml
|
|
when:
|
|
- bootstrap_host_loopback_nova | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the Swift data storage loopback disks
|
|
- name: Include prepare_loopback_swift tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_swift.yml
|
|
when:
|
|
- bootstrap_host_loopback_swift | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the Manila data storage loopback disks
|
|
- name: Include prepare_loopback_manila tasks
|
|
ansible.builtin.include_tasks: prepare_loopback_manila.yml
|
|
when:
|
|
- bootstrap_host_loopback_manila | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-loopback
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the Ceph cluster UUID and loopback disks
|
|
- name: Include prepare_ceph tasks
|
|
ansible.builtin.include_tasks: prepare_ceph.yml
|
|
when:
|
|
- bootstrap_host_ceph | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-ceph
|
|
tags:
|
|
- always
|
|
|
|
# Prepare the NFS server and loopback disks
|
|
- name: Include prepare_nfs tasks
|
|
ansible.builtin.include_tasks: prepare_nfs.yml
|
|
when:
|
|
- bootstrap_host_nfs | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-nfs
|
|
tags:
|
|
- always
|
|
|
|
# Ensure hostname/ip is consistent with inventory
|
|
- name: Import prepare_hostname tasks
|
|
ansible.builtin.import_tasks: prepare_hostname.yml
|
|
tags:
|
|
- prepare-hostname
|
|
|
|
# Prepare the network interfaces
|
|
- name: Import prepare_networking tasks
|
|
ansible.builtin.include_tasks: prepare_networking.yml
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-networking
|
|
when:
|
|
- ansible_facts['os_family'] == 'RedHat'
|
|
tags:
|
|
- prepare-networking
|
|
|
|
# Ensure that there are both private and public ssh keys for root
|
|
- name: Import prepare_ssh_keys tasks
|
|
ansible.builtin.import_tasks: prepare_ssh_keys.yml
|
|
tags:
|
|
- prepare-ssh-keys
|
|
|
|
# Prepare local squid proxy
|
|
- name: Include prepare_squid tasks
|
|
ansible.builtin.include_tasks: prepare_squid.yml
|
|
when:
|
|
- "'proxy' in bootstrap_host_scenarios_expanded"
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-squid
|
|
tags:
|
|
- always
|
|
|
|
# Prepare local step-ca certificate authority
|
|
- name: Include prepare_step_ca tasks
|
|
ansible.builtin.include_tasks: prepare_step_ca.yml
|
|
when:
|
|
- "'stepca' in bootstrap_host_scenarios_expanded"
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-step-ca
|
|
tags:
|
|
- always
|
|
|
|
# Put the OpenStack-Ansible configuration for an All-In-One on the host
|
|
- name: Include prepare_aio_config tasks
|
|
ansible.builtin.include_tasks: prepare_aio_config.yml
|
|
when:
|
|
- bootstrap_host_aio_config | bool
|
|
args:
|
|
apply:
|
|
tags:
|
|
- prepare-aio-config
|
|
tags:
|
|
- always
|