4a83b740d7
With this patch, we are adding a new role discover-latest-image to discover the latest Centos Stream image, We are limiting the scope for C9 for now, We can extend the role for Centos 8 image discovery in future if there is a need. Also, we are updating baremetal-prep-virthost.yml playbook to use this new role for c9 case and in combination with patch[1] - we will get rid of undercloud baseos hardcoding and use the latest discovered image. [1] https://review.opendev.org/c/openstack/tripleo-quickstart/+/838990/ Change-Id: I3a97edc63e96725a1690335f557508d56ed10258
206 lines
5.7 KiB
YAML
206 lines
5.7 KiB
YAML
---
|
|
# Add the virthost to the in-memory inventory. The inventory is not
|
|
# wirtten out to disk unless you call the `rebuild-inventory` role.
|
|
- name: Add the virthost to the inventory
|
|
hosts: localhost
|
|
tasks:
|
|
- name: Add virthost
|
|
add_host:
|
|
name: "{{ virthost }}"
|
|
groups: "virthost"
|
|
ansible_fqdn: "{{ virthost }}"
|
|
ansible_user: "root"
|
|
ansible_host: "{{ virthost }}"
|
|
ansible_private_key_file: "{{ ansible_private_key_file_location | default('') }}"
|
|
|
|
- include: teardown-provision.yml
|
|
|
|
# The `provision.yml` playbook is responsible for
|
|
# creating an inventory entry for our `virthost` and for creating an
|
|
# unprivileged user on that host for use by our virtual environment.
|
|
- include: provision.yml
|
|
|
|
# These teardown tasks only make sense after running provision.yml,
|
|
# because they assume they are connecting as the `stack` user rather
|
|
# than `root`.
|
|
- include: teardown-nodes.yml
|
|
- include: teardown-environment.yml
|
|
|
|
- name: setup yum repos on virthost
|
|
hosts: virthost
|
|
gather_facts: true
|
|
roles:
|
|
- repo-setup
|
|
tags:
|
|
- provision
|
|
|
|
# The `environment/setup` role performs any tasks that require `root`
|
|
# access on the target host.
|
|
- name: Install libvirt packages and configure networks
|
|
hosts: virthost
|
|
tags:
|
|
- environment
|
|
roles:
|
|
- environment/setup
|
|
|
|
- name: Check whether to build images
|
|
hosts: virthost
|
|
gather_facts: true
|
|
roles:
|
|
- check-to-build-or-not-to-build
|
|
|
|
- name: Add firewalld services and ports
|
|
hosts: virthost
|
|
gather_facts: false
|
|
tasks:
|
|
- include_role:
|
|
name: baremetal-prep-virthost
|
|
tasks_from: add_services_ports_firewalld.yml
|
|
when:
|
|
- ansible_distribution == 'RedHat'
|
|
- ansible_distribution_major_version|int >= 8
|
|
|
|
- name: Find latest Centos image and set facts for undercloud base image.
|
|
hosts: virthost
|
|
gather_facts: true
|
|
tasks:
|
|
- block:
|
|
- name: Discover latest CentOS qcow2 image
|
|
include_role:
|
|
name: discover-latest-image
|
|
- name: set_fact for undercloud base image
|
|
set_fact:
|
|
baseos_undercloud_image_url: "{{ discovered_image_url }}"
|
|
baseos_image: "{{ ansible_distribution | lower }}"
|
|
baseos_image_type: qcow2
|
|
baseos_md5sum: "{{ discovered_md5sum }} {{ discovered_image_name }}"
|
|
cacheable: true
|
|
when:
|
|
- ansible_distribution == 'CentOS'
|
|
- ansible_distribution_major_version is version(9, '>=')
|
|
|
|
- name: Setup undercloud and baremetal vms and networks in libvirt
|
|
hosts: virthost
|
|
gather_facts: true
|
|
vars:
|
|
baseos: true
|
|
roles:
|
|
- libvirt/setup
|
|
|
|
# Add the undercloud node to the generated
|
|
# inventory.
|
|
- name: Inventory the undercloud
|
|
hosts: localhost
|
|
gather_facts: true
|
|
vars:
|
|
inventory: undercloud
|
|
roles:
|
|
- tripleo-inventory
|
|
|
|
- name: Set to_build on undercloud
|
|
hosts: undercloud
|
|
gather_facts: true
|
|
tasks:
|
|
- name: set_fact for to_build on undercloud
|
|
set_fact:
|
|
to_build: "{{ hostvars[groups['virthost'][0]]['to_build'] }}"
|
|
cacheable: true
|
|
|
|
- name: set_fact for image_cache_dir on undercloud
|
|
set_fact:
|
|
image_cache_dir: "{{ working_dir }}/images-cache"
|
|
cacheable: true
|
|
|
|
- name: set_fact for libguestfs_mode on undercloud
|
|
set_fact:
|
|
libguestfs_mode: false
|
|
cacheable: true
|
|
|
|
# Always build images even if running a periodic-* named job
|
|
# in a check pipeline for testing
|
|
- name: Always build images in periodic
|
|
set_fact:
|
|
to_build: true
|
|
cacheable: true
|
|
when: "'periodic' in zuul.job"
|
|
|
|
- name: Setup the undercloud
|
|
hosts: undercloud
|
|
gather_facts: true
|
|
vars:
|
|
non_root_user_setup: false
|
|
roles:
|
|
- undercloud-setup
|
|
|
|
- name: Remove ens3 if not required
|
|
hosts: undercloud
|
|
gather_facts: false
|
|
tasks:
|
|
- include_role:
|
|
name: baremetal-prep-virthost
|
|
tasks_from: remove_ens3.yml
|
|
when:
|
|
- ansible_distribution == 'CentOS'
|
|
- ansible_distribution_major_version|int >= 8
|
|
|
|
- name: Ensure locale has LANG=en_US.UTF-8
|
|
hosts: undercloud
|
|
gather_facts: false
|
|
tasks:
|
|
- include_role:
|
|
name: baremetal-prep-virthost
|
|
tasks_from: set_locale_UTF_8
|
|
when:
|
|
- ansible_distribution == 'RedHat'
|
|
- ansible_distribution_major_version|int >= 8
|
|
|
|
- name: Prepare the host for PXE forwarding
|
|
hosts: virthost
|
|
gather_facts: true
|
|
roles:
|
|
- baremetal-prep-virthost
|
|
|
|
- name: Get images for quickstart
|
|
hosts: undercloud
|
|
gather_facts: true
|
|
vars:
|
|
ib_repo_image_inject: "{{ not to_build|bool }}"
|
|
ib_repo_run_live: false
|
|
modify_image_vc_ram: 4096
|
|
modify_image_vc_cpu: 4
|
|
modify_image_vc_verbose: true
|
|
tasks:
|
|
- include_role:
|
|
name: fetch-images
|
|
when: not to_build|bool
|
|
|
|
- include_role:
|
|
name: repo-setup
|
|
vars:
|
|
repo_inject_image_path: "/home/{{ undercloud_user }}/{{ overcloud_image }}.qcow2"
|
|
repo_run_live: false
|
|
when: not to_build|bool
|
|
|
|
- include_role:
|
|
name: repo-setup
|
|
vars:
|
|
repo_inject_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs"
|
|
repo_run_live: false
|
|
initramfs_image: true
|
|
libguestfs_mode: false
|
|
when: not to_build|bool
|
|
|
|
- include_role:
|
|
name: install-built-repo
|
|
vars:
|
|
ib_repo_image_path: "/home/{{ undercloud_user }}/{{ overcloud_image }}.qcow2"
|
|
when: compressed_gating_repo is defined and not to_build|bool
|
|
|
|
- include_role:
|
|
name: install-built-repo
|
|
vars:
|
|
ib_repo_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs"
|
|
initramfs_image: true
|
|
libguestfs_mode: false
|
|
when: compressed_gating_repo is defined and not to_build|bool
|