metalsmith/playbooks/integration/cirros-image.yaml
Dmitry Tantsur 77d802f3d6 Deprecate instance network boot
Remove or update the corresponding CI jobs. Use the new custom Cirros
image in the HTTP job to avoid relying on CentOS.

Temporary increase complexity requirements while we have a deprecation
warning in the provisioner.

Change-Id: I5e65f9949ee3b78430309017800b88c1ba21dd02
2022-08-24 13:19:52 +02:00

89 lines
3.7 KiB
YAML

---
- name: Find Cirros partition image
shell: openstack image list -f value -c Name | grep 'cirros-.*-partition$' | sort | tail -n1
register: cirros_partition_image_result
failed_when: cirros_partition_image_result.stdout == ""
- name: Find Cirros disk image
shell: openstack image list -f value -c Name | grep 'cirros-.*-disk$' | sort | tail -n1
register: cirros_disk_image_result
failed_when: cirros_disk_image_result.stdout == ""
- name: Set image facts for Glance image
set_fact:
metalsmith_whole_disk_image: "{{ cirros_disk_image_result.stdout }}"
metalsmith_partition_image: "{{ cirros_partition_image_result.stdout }}"
when: not (metalsmith_use_http | default(false))
- block:
- name: Find Cirros UEC image
shell: openstack image list -f value -c Name | grep 'cirros-.*-uec$' | sort | tail -n1
register: cirros_uec_image_result
failed_when: cirros_uec_image_result.stdout == ""
- name: Get baremetal HTTP endpoint
shell: |
source /opt/stack/devstack/openrc admin admin > /dev/null
iniget /etc/ironic/ironic.conf deploy http_url
args:
executable: /bin/bash
register: baremetal_endpoint_result
failed_when: baremetal_endpoint_result.stdout == ""
- name: Copy UEC images directory
command: >
cp -r /opt/stack/devstack/files/images/{{ cirros_uec_image_result.stdout }}
/opt/stack/data/ironic/httpboot/metalsmith
args:
creates: /opt/stack/data/ironic/httpboot/metalsmith
become: yes
- name: Copy whole disk image
command: >
cp /opt/stack/devstack/files/{{ cirros_disk_image_result.stdout }}.img
/opt/stack/data/ironic/httpboot/metalsmith/
args:
creates: /opt/stack/data/ironic/httpboot/metalsmith/{{ cirros_disk_image_result.stdout }}.img
become: yes
- name: Copy partition image
command: >
cp /opt/stack/data/ironic/{{ cirros_partition_image_result.stdout }}.img
/opt/stack/data/ironic/httpboot/metalsmith
args:
creates: /opt/stack/data/ironic/httpboot/metalsmith/{{ cirros_partition_image_result.stdout }}.img
become: yes
- name: Create MD5 checksums file for images
shell: md5sum cirros-* > CHECKSUMS
args:
chdir: /opt/stack/data/ironic/httpboot/metalsmith
become: yes
- name: Change ownership of image files
file:
path: /opt/stack/data/ironic/httpboot/metalsmith
state: directory
owner: "{{ ansible_user }}"
recurse: yes
mode: a+r
become: yes
- name: Calculate MD5 checksum for HTTP disk image
shell: |
md5sum /opt/stack/devstack/files/{{ cirros_disk_image_result.stdout }}.img \
| awk '{ print $1; }'
register: cirros_disk_image_checksum_result
failed_when: cirros_disk_image_checksum_result.stdout == ""
- name: Set facts for HTTP image
set_fact:
metalsmith_partition_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_partition_image_result.stdout }}.img"
metalsmith_partition_kernel_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_uec_image_result.stdout | replace('-uec', '-vmlinuz') }}"
metalsmith_partition_ramdisk_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_uec_image_result.stdout | replace('-uec', '-initrd') }}"
metalsmith_partition_checksum: "{{ baremetal_endpoint_result.stdout}}/metalsmith/CHECKSUMS"
metalsmith_whole_disk_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_disk_image_result.stdout }}.img"
metalsmith_whole_disk_checksum: "{{ cirros_disk_image_checksum_result.stdout }}"
when: metalsmith_use_http | default(false)