kayobe/ansible/overcloud-host-image-build.yml
Pierre Riteau c35f112a14 Build overcloud host image directly with DIB
As a first step towards supporting multiple overcloud disk images, this
change introduces a new command to build a disk image directly with DIB:
`kayobe overcloud host image build`.

It also disables building a root disk image during Bifrost bootstrap if
overcloud_dib_build_host_images is set to true.

Change-Id: I93d242889e225b4e60254f6b9cc5eeb457294ac8
Story: 2002098
Task: 41693
2021-11-26 09:28:00 +01:00

52 lines
2.0 KiB
YAML

---
# Build and install a overcloud host disk image for the seed host's ironic
# service.
- name: Ensure overcloud host disk image is built and installed
hosts: seed
tags:
- overcloud-host-image-build
vars:
overcloud_host_image_name: "deployment_image"
overcloud_host_disk_images:
- "{{ overcloud_host_image_name }}.qcow2"
overcloud_host_image_force_rebuild: False
tasks:
- block:
- name: Ensure overcloud host disk image is built
include_role:
name: stackhpc.os-images
vars:
os_images_venv: "{{ virtualenv_path }}/overcloud-host-image-dib"
os_images_package_state: latest
os_images_upper_constraints_file: "{{ pip_upper_constraints_file }}"
os_images_cache: "{{ image_cache_path }}"
os_images_common: ""
os_images_list:
- name: "{{ overcloud_host_image_name }}"
elements: "{{ overcloud_dib_elements }}"
env: "{{ overcloud_dib_env_vars }}"
packages: "{{ overcloud_dib_packages }}"
type: qcow2
os_images_upload: False
os_images_force_rebuild: "{{ overcloud_host_image_force_rebuild }}"
- name: Ensure overcloud host disk image is copied onto seed
copy:
src: "{{ image_cache_path }}/{{ overcloud_host_image_name }}/{{ item }}"
dest: "/etc/kolla/bifrost/{{ item }}"
remote_src: True
with_items: "{{ overcloud_host_disk_images }}"
become: True
- name: Copy overcloud host disk image into /httpboot
command: >
docker exec bifrost_deploy
bash -c 'ansible -vvvv target
-i /bifrost/playbooks/inventory/target
-m copy
-a "src=/etc/bifrost/{{ item }} dest=/httpboot/{{ item }}"
-e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"'
with_items: "{{ overcloud_host_disk_images }}"
when: overcloud_dib_build_host_images | bool