|
1 | 1 | --- |
2 | | -# Build and install a overcloud host disk image for the seed host's ironic |
| 2 | +# Build and install overcloud host disk images for the seed host's ironic |
3 | 3 | # service. |
4 | 4 |
|
5 | | -- name: Ensure overcloud host disk image is built and installed |
| 5 | +- name: Ensure overcloud host disk images are built and installed |
6 | 6 | hosts: seed |
7 | 7 | tags: |
8 | 8 | - overcloud-host-image-build |
9 | 9 | vars: |
10 | | - overcloud_host_image_name: "deployment_image" |
11 | | - overcloud_host_disk_images: |
12 | | - - "{{ overcloud_host_image_name }}.qcow2" |
13 | 10 | overcloud_host_image_force_rebuild: False |
14 | 11 | tasks: |
15 | 12 | - block: |
16 | | - - name: Ensure overcloud host disk image is built |
| 13 | + - name: Validate overcloud host disk image configuration |
| 14 | + assert: |
| 15 | + that: |
| 16 | + - overcloud_dib_host_images is sequence |
| 17 | + - overcloud_dib_host_images | selectattr('name', 'undefined') | list | length == 0 |
| 18 | + - overcloud_dib_host_images | selectattr('elements', 'undefined') | list | length == 0 |
| 19 | + msg: "overcloud_dib_host_images set to invalid value" |
| 20 | + |
| 21 | + - name: Ensure overcloud host disk images are built |
17 | 22 | include_role: |
18 | 23 | name: stackhpc.os-images |
19 | 24 | vars: |
|
22 | 27 | os_images_upper_constraints_file: "{{ overcloud_dib_upper_constraints_file }}" |
23 | 28 | os_images_cache: "{{ image_cache_path }}" |
24 | 29 | os_images_common: "" |
25 | | - os_images_list: |
26 | | - - name: "{{ overcloud_host_image_name }}" |
27 | | - elements: "{{ overcloud_dib_elements }}" |
28 | | - env: "{{ overcloud_dib_env_vars }}" |
29 | | - packages: "{{ overcloud_dib_packages }}" |
30 | | - type: qcow2 |
| 30 | + os_images_list: "{{ overcloud_dib_host_images }}" |
| 31 | + os_images_git_elements: "{{ overcloud_dib_git_elements }}" |
31 | 32 | os_images_upload: False |
32 | 33 | os_images_force_rebuild: "{{ overcloud_host_image_force_rebuild }}" |
33 | 34 |
|
34 | | - - name: Ensure overcloud host disk image is copied onto seed |
| 35 | + - name: Copy overcloud host disk images into /httpboot |
35 | 36 | copy: |
36 | | - src: "{{ image_cache_path }}/{{ overcloud_host_image_name }}/{{ item }}" |
37 | | - dest: "/etc/kolla/bifrost/{{ item }}" |
| 37 | + src: "{{ image_cache_path }}/{{ image.name }}/{{ image.name }}.{{ image.type | default('qcow2') }}" |
| 38 | + dest: "/var/lib/docker/volumes/bifrost_httpboot/_data/{{ image.name }}.{{ image.type | default('qcow2') }}" |
38 | 39 | remote_src: True |
39 | | - with_items: "{{ overcloud_host_disk_images }}" |
| 40 | + with_items: "{{ overcloud_dib_host_images }}" |
| 41 | + loop_control: |
| 42 | + loop_var: image |
40 | 43 | become: True |
41 | | - |
42 | | - - name: Copy overcloud host disk image into /httpboot |
43 | | - command: > |
44 | | - docker exec bifrost_deploy |
45 | | - bash -c 'ansible -vvvv target |
46 | | - -i /bifrost/playbooks/inventory/target |
47 | | - -m copy |
48 | | - -a "src=/etc/bifrost/{{ item }} dest=/httpboot/{{ item }}" |
49 | | - -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"' |
50 | | - with_items: "{{ overcloud_host_disk_images }}" |
51 | 44 | when: overcloud_dib_build_host_images | bool |
0 commit comments