Add way to customize the IPA version to be used

By using -e ipa_upstream_release=stable-mitaka, deployment
can now use all ramdisk and kernel images available in
https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/
Furthermore, as some of these files do not have any .sha256
checksum associated to them, the downloading of these file
is now just issuing a "warning" and is not reported as an
Ansible error in the final summary.

Change-Id: Ib7624da0f7d5686f0f5cb6c6e98b48870364e91b
This commit is contained in:
Olivier Bourdon 2018-02-09 11:43:30 +01:00
parent 78717f7ea4
commit 7792531443
3 changed files with 39 additions and 6 deletions

View File

@ -40,14 +40,15 @@ ans_network_interface: "{{ network_interface | replace('-', '_') }}"
# documentation at http://ipxe.org/crypto
ipa_file_protocol: "http"
ipa_upstream_release: "master"
ipa_kernel: "{{http_boot_folder}}/ipa.vmlinuz"
ipa_ramdisk: "{{http_boot_folder}}/ipa.initramfs"
ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.vmlinuz"
ipa_kernel_upstream_url: https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-master.vmlinuz
ipa_kernel_upstream_url: "https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-{{ ipa_upstream_release }}.vmlinuz"
ipa_kernel_upstream_checksum_algo: "sha256"
ipa_kernel_upstream_checksum_url: "{{ ipa_kernel_upstream_url }}.{{ ipa_kernel_upstream_checksum_algo }}"
ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.initramfs"
ipa_ramdisk_upstream_url: https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-master.gz
ipa_ramdisk_upstream_url: "https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-{{ ipa_upstream_release }}.gz"
ipa_ramdisk_upstream_checksum_algo: "sha256"
ipa_ramdisk_upstream_checksum_url: "{{ ipa_ramdisk_upstream_url }}.{{ ipa_ramdisk_upstream_checksum_algo }}"
deploy_image_filename: "deployment_image.qcow2"

View File

@ -22,14 +22,23 @@
- block:
- name: "Download IPA kernel checksum file"
get_url: url="{{ ipa_kernel_upstream_checksum_url }}" dest="{{ ipa_kernel }}.{{ ipa_kernel_upstream_checksum_algo }}" timeout=300
register: ipa_kernel_checksum_result
ignore_errors: yes
- debug: msg="WARNING!!! {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }}"
when: ipa_kernel_checksum_result is defined and ipa_kernel_checksum_result.status_code is defined and ipa_kernel_checksum_result.status_code == 404
- fail: msg="FATAL {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }} GOT {{ ipa_kernel_checksum_result }}"
when: ipa_kernel_checksum_result is not defined or ipa_kernel_checksum_result.changed is not defined or
(ipa_kernel_checksum_result.changed and ipa_kernel_checksum_result.status_code != 404 and ipa_kernel_checksum_result.status_code != 200)
- name: "Extract IPA kernel checksum"
shell: awk '/{{ ipa_kernel_upstream_url | basename }}/{print $1}' "{{ ipa_kernel }}.{{ ipa_kernel_upstream_checksum_algo }}"
register: parsed_ipa_kernel_checksum
when: not ipa_kernel_checksum_result|failed
- fail:
msg: "Failed to extract checksum for {{ ipa_kernel_upstream_url | basename }}"
when: parsed_ipa_kernel_checksum.stdout == ""
when: not ipa_kernel_checksum_result|failed and parsed_ipa_kernel_checksum.stdout == ""
- set_fact:
ipa_kernel_checksum: "{{ ipa_kernel_upstream_checksum_algo }}:{{ parsed_ipa_kernel_checksum.stdout }}"
when: not ipa_kernel_checksum_result|failed
when: ipa_kernel_upstream_checksum_url != ""
- name: "Download IPA kernel"
@ -41,7 +50,8 @@
# Keep downloading it until we get a good copy
force: yes
register: ipa_kernel_download_done
until: ipa_kernel_download_done|succeeded
until: ipa_kernel_download_done|succeeded or
(ipa_kernel_download_done|failed and ipa_kernel_download_done.status_code == 404)
retries: 5
delay: 10
when: test_ipa_kernel_present.stat.exists == false
@ -53,14 +63,23 @@
- block:
- name: "Download IPA image checksum"
get_url: url="{{ ipa_ramdisk_upstream_checksum_url }}" dest="{{ ipa_ramdisk }}.{{ ipa_ramdisk_upstream_checksum_algo }}" timeout=300
register: ipa_ramdisk_checksum_result
ignore_errors: yes
- debug: msg="WARNING!!! {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}"
when: ipa_ramdisk_checksum_result is defined and ipa_ramdisk_checksum_result.status_code is defined and ipa_ramdisk_checksum_result.status_code == 404
- fail: msg="FATAL {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}"
when: ipa_ramdisk_checksum_result is not defined or ipa_ramdisk_checksum_result.changed is not defined or
(ipa_ramdisk_checksum_result.changed and ipa_ramdisk_checksum_result.status_code != 404 and ipa_ramdisk_checksum_result.status_code != 200)
- name: "Extract IPA ramdisk checksum"
shell: awk '/{{ ipa_ramdisk_upstream_url | basename }}/{print $1}' "{{ ipa_ramdisk }}.{{ ipa_ramdisk_upstream_checksum_algo }}"
register: parsed_ipa_ramdisk_checksum
when: not ipa_ramdisk_checksum_result|failed
- fail:
msg: "Failed to extract checksum for {{ ipa_ramdisk_upstream_url | basename }}"
when: parsed_ipa_ramdisk_checksum.stdout == ""
when: not ipa_ramdisk_checksum_result|failed and parsed_ipa_ramdisk_checksum.stdout == ""
- set_fact:
ipa_ramdisk_checksum: "{{ ipa_ramdisk_upstream_checksum_algo }}:{{ parsed_ipa_ramdisk_checksum.stdout }}"
when: not ipa_ramdisk_checksum_result|failed
when: ipa_ramdisk_upstream_checksum_url != ""
- name: "Download IPA image"
@ -72,7 +91,8 @@
# Keep downloading it until we get a good copy
force: yes
register: ipa_ramdisk_download_done
until: ipa_ramdisk_download_done|succeeded
until: ipa_ramdisk_download_done|succeeded or
(ipa_ramdisk_download_done|failed and ipa_ramdisk_download_done.status_code == 404)
retries: 5
delay: 10
when: test_ipa_image_present.stat.exists == false

View File

@ -0,0 +1,12 @@
---
features:
- |
By adding extra variable ``-e ipa_upstream_release=stable-mitaka`` for instance,
the deployment can now use all ramdisk and kernel images available in
https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/
instead of the default ``master``.
Furthermore, as some of these files do not have any .sha256
checksum associated to them, the downloading of these file
is now just issuing a "warning" and is not reported as an
Ansible error in the final summary.