kayobe/ansible/seed-ipa-build.yml
Mark Goddard 22cf08e882 Support forcing rebuild of deployment images
It is hard to know when disk images need to be rebuilt, and the
stackhpc.os-images role simply checks for the presence of the DIB output
directory to indicate that an image exists. In some cases, we may wish to force
the rebuilding of a deployment (IPA) image, when we know there are changes to
apply. This change adds a --force-rebuild argument to the following commands:

kayobe seed deployment image build
kayobe overcloud deployment image build

Change-Id: I580811a4f621df9445ef32773ca66bcf303dad9b
2018-06-22 14:43:29 +01:00

57 lines
2.1 KiB
YAML

---
# Build and install an Ironic Python Agent (IPA) image for the seed host's
# ironic and ironic-inspector services.
- name: Ensure Ironic Python Agent images are built and installed
hosts: seed
tags:
- ipa-build
vars:
ipa_image_name: "ipa"
ipa_images:
- "{{ ipa_image_name }}.vmlinuz"
- "{{ ipa_image_name }}.initramfs"
ipa_image_force_rebuild: false
tasks:
- block:
- name: Ensure existing Ironic Python Agent images are removed (force rebuild)
file:
path: "{{ image_cache_path }}/{{ ipa_image_name }}"
state: absent
when: ipa_image_force_rebuild | bool
- name: Ensure Ironic Python Agent images are built
include_role:
name: stackhpc.os-images
vars:
os_images_venv: "{{ virtualenv_path }}/ipa-build-dib"
os_images_cache: "{{ image_cache_path }}"
os_images_common: ""
os_images_list:
- name: "{{ ipa_image_name }}"
elements: "{{ ipa_build_dib_elements }}"
env: "{{ ipa_build_dib_env }}"
# Avoid needing to install qemu-img for qcow2 image.
type: raw
os_images_git_elements: "{{ ipa_build_dib_git_elements }}"
os_images_upload: False
- name: Ensure Ironic Python Agent images are copied onto seed
copy:
src: "{{ image_cache_path }}/{{ ipa_image_name }}/{{ item }}"
dest: "/etc/kolla/bifrost/{{ item }}"
remote_src: True
with_items: "{{ ipa_images }}"
become: True
- name: Copy Ironic Python Agent images into /httpboot
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars &&
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: "{{ ipa_images }}"
when: ipa_build_images | bool