From caea075deb3635b298cd45cd6ee12bda636b1c8b Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Mon, 30 Nov 2015 14:49:49 -0500 Subject: [PATCH] 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 --- playbooks/roles/bifrost-create-dib-image/README.md | 10 +++++++++- playbooks/roles/bifrost-create-dib-image/meta/main.yml | 2 +- .../roles/bifrost-create-dib-image/tasks/main.yml | 8 ++++++-- playbooks/test-bifrost-dynamic.yaml | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/playbooks/roles/bifrost-create-dib-image/README.md b/playbooks/roles/bifrost-create-dib-image/README.md index ced5ab176..72d6a588e 100644 --- a/playbooks/roles/bifrost-create-dib-image/README.md +++ b/playbooks/roles/bifrost-create-dib-image/README.md @@ -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 diff --git a/playbooks/roles/bifrost-create-dib-image/meta/main.yml b/playbooks/roles/bifrost-create-dib-image/meta/main.yml index 57d293abd..5ba6c582f 100644 --- a/playbooks/roles/bifrost-create-dib-image/meta/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/meta/main.yml @@ -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: diff --git a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml index f3cf0e655..e077bf7d6 100644 --- a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml @@ -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 diff --git a/playbooks/test-bifrost-dynamic.yaml b/playbooks/test-bifrost-dynamic.yaml index d7ab75f16..b4283157b 100644 --- a/playbooks/test-bifrost-dynamic.yaml +++ b/playbooks/test-bifrost-dynamic.yaml @@ -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') }}"