tripleo-quickstart/roles/libvirt/setup/undercloud/tasks/inject_gating_repo.yml

44 lines
1.6 KiB
YAML

---
- name: Create the injection script
template:
src: inject_gating_repo.sh.j2
dest: "{{ working_dir }}/inject_gating_repo.sh"
- environment:
LIBGUESTFS_BACKEND: direct
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
block:
# We need to extract the overcloud image, if it's not already extracted.
# so we can inject the gating repo into it.
- name: check if overcloud image is already extracted
stat:
path: '{{ working_dir }}/overcloud-full.qcow2'
register: overcloud_image_stat
- name: Extract overcloud-full image
command: >
virt-copy-out -a {{ working_dir }}/undercloud.qcow2
/home/{{ undercloud_user }}/overcloud-full.qcow2 {{ working_dir }}
register: overcloud_image_extracted
when: not overcloud_image_stat.stat.exists
- name: Inject the gating repo (overcloud-full)
command: >
virt-customize -a {{ working_dir }}/overcloud-full.qcow2
--upload {{ compressed_gating_repo }}:/tmp/gating_repo.tar.gz
--run '{{ working_dir }}/inject_gating_repo.sh'
- name: Copy updated overcloud-full image back to undercloud
command: >
virt-copy-in -a {{ working_dir }}/undercloud.qcow2
{{ working_dir }}/overcloud-full.qcow2 /home/{{ undercloud_user }}/
when: overcloud_image_extracted is defined and overcloud_image_extracted|changed
- name: Inject the gating repo (undercloud)
command: >
virt-customize -a {{ working_dir }}/undercloud.qcow2
--upload {{ compressed_gating_repo }}:/tmp/gating_repo.tar.gz
--run '{{ working_dir }}/inject_gating_repo.sh'
when: not overcloud_as_undercloud|bool