Allow user to set DIB_RELEASE for disk images

This change has two parts.  First it allows a user to define an
argument to the role that is wraped around diskimage-builder to
add an optional environment variable of DIB_RELEASE to the build
process.

Secondly it sets a default for the test sequence to utilize debian
jessie for the builds to stabilize the non-voting CI test.

Change-Id: Ifbc0f1ce42f3ab9ec73951a813ab0c4a38639550
Closes-Bug: #1521313
This commit is contained in:
Julia Kreger 2015-11-30 14:49:49 -05:00
parent 807c17c396
commit caea075deb
4 changed files with 18 additions and 6 deletions

View File

@ -8,7 +8,7 @@ Requirements
This role requires:
- Ansible 1.9
- Ansible 2.0
Role Variables
--------------
@ -46,6 +46,14 @@ on the resulting disk image.
dib_packages: "traceroute,python-devel"
dib_os_release can be utilized to set the DIB_RELEASE environment
variable for semi-dynamic disk image creation by a user or the
test script. By default, it is not set, but an example if
dib_os_element is set to ``debian``, then a user could choose
the ``jessie`` release.
dib_os_release: jessie
All the other command-line options to disk-image-create or
ramdisk-image-create can be used by the role. The following is a list
of the command-line options, their corresponding variables, and the type

View File

@ -4,7 +4,7 @@ galaxy_info:
description: Create image with diskimage-builder for Bifrost
company: OpenStack
license: Apache
min_ansible_version: 1.9
min_ansible_version: 2.0
platforms:
- name: EL
versions:

View File

@ -104,14 +104,18 @@
set_fact:
dib_packages_arg: "-p {{dib_packages}}"
when: dib_packages is defined and dib_packages != ""
- name: "Set the DIB_RELEASE environment variable if set"
set_fact:
dib_env_vars: "{{dib_env_vars | combine({'DIB_RELEASE':dib_os_release}) }}"
when: dib_os_release is defined
- name: "Build argument list"
set_fact:
dib_arglist: "{{dib_trace_arg|default('')}} {{dib_uncompressed_arg|default('')}} {{dib_clearenv_arg|default('')}} {{dib_notmpfs_arg|default('')}} {{dib_offline_arg|default('')}} {{dib_skipbase_arg|default('')}} {{dib_arch_arg|default('')}} {{dib_imagename_arg|default('')}} {{dib_imagetype_arg|default('')}} {{dib_imagesize_arg|default('')}} {{dib_imagecache_arg|default('')}} {{dib_maxresize_arg|default('')}} {{dib_mintmpfs_arg|default('')}} {{dib_mkfsopts_arg|default('')}} {{dib_qemuopts_arg|default('')}} {{dib_rootlabel_arg|default('')}} {{dib_rdelement_arg|default('')}} {{dib_installtype_arg|default('')}} {{dib_packages_arg|default('')}} {{dib_os_element}} {{dib_elements|default('')}}"
- name: "Initiate image build"
command: disk-image-create {{dib_arglist}}
environment: dib_env_vars
environment: "{{ dib_env_vars }}"
when: build_ramdisk | bool == false and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false
- name: "Initiate ramdisk build"
command: ramdisk-image-create {{dib_arglist}}
environment: dib_env_vars
environment: "{{ dib_env_vars }}"
when: build_ramdisk | bool == true and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false

View File

@ -57,8 +57,8 @@
# NOTE(TheJulia): While the next step creates a ramdisk, some elements
# do not support ramdisk-image-create as they invoke steps to cleanup
# the ramdisk which causes ramdisk-image-create to believe it failed.
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagetype: "qcow2", dib_imagename: "{{deploy_image}}", dib_os_element: "debian", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", when: create_image_via_dib == true and transform_boot_image == false }
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_os_release: "jessie", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagetype: "qcow2", dib_imagename: "{{deploy_image}}", dib_os_element: "debian", dib_os_release: "jessie", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", when: create_image_via_dib == true and transform_boot_image == false }
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"
https_proxy: "{{ lookup('env','https_proxy') }}"