Add overcloud image build role
Adds tripleo_overcloud_image_build role to create overcloud and ironic-python-agent images. Change-Id: I625f121d12e71d5267e9f416b4c32fe8ec539ec0
This commit is contained in:
parent
965fae05e7
commit
62fc0eacf2
61
roles/tripleo_overcloud_image_build/README.md
Normal file
61
roles/tripleo_overcloud_image_build/README.md
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
tripleo_overcloud_image_build
|
||||||
|
============================
|
||||||
|
|
||||||
|
A role to perform an overcloud image build for provisioning.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* `tripleo_overcloud_image_build_config_files`: (List) List of YAML config files specifying the image build.
|
||||||
|
* `tripleo_overcloud_image_build_debug`: (Boolean) Flag to print out the push command. Default: False
|
||||||
|
* `tripleo_overcloud_image_build_dib_local_image`: (String) String containing the path to a local image to use when building.
|
||||||
|
* `tripleo_overcloud_image_build_dib_yum_repo_conf`: (String) String containing the path to the yum files for the image building process. Default: "/etc/yum.repos.d/*"
|
||||||
|
* `tripleo_overcloud_image_build_extra_env_vars`: (Dictionary) Dictionary containing extra environment variables to be set for the build. Default: {}
|
||||||
|
* `tripleo_overcloud_image_build_home_dir`: (String) Path that the command should be executed in. Default: "{{ ansible_env.HOME }}"
|
||||||
|
* `tripleo_overcloud_image_build_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true
|
||||||
|
* `tripleo_overcloud_image_build_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true
|
||||||
|
* `tripleo_overcloud_image_build_image_names`: (List) List of image names to build.
|
||||||
|
* `tripleo_overcloud_image_build_no_skip`: (Boolean) Flag to skipp build if cached image exists. Default: False
|
||||||
|
* `tripleo_overcloud_image_build_output_directory`: (String) Path to the output directory for the images.
|
||||||
|
* `tripleo_overcloud_image_build_stable_release`: (String) String containing the name of teh stable branch being built.
|
||||||
|
* `tripleo_overcloud_image_build_poll`: (Integer) Number of seconds to wait between checks to see if the build command has completed. This should be set to a value greater or equal to 1. Default: 10
|
||||||
|
* `tripleo_overcloud_image_build_timeout`: (Integer) Amount of time to wait for the command to conplete. Default: 1800
|
||||||
|
* `tripleo_overcloud_image_build_log`: (String) Install log file path. Default: "{{ tripleo_overcloud_image_build_home_dir }}/overcloud_image_build.log"
|
||||||
|
|
||||||
|
Output Variables
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* `tripleo_overcloud_image_build_result`: Ansible shell execution results
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Example container push execution playbook
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- hosts: undercloud
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
- name: Build overcloud image
|
||||||
|
import_role:
|
||||||
|
name: tripleo_overcloud_image_build
|
||||||
|
vars:
|
||||||
|
tripleo_overcloud_image_build_config_files:
|
||||||
|
- /usr/share/openstack-tripleo-common/image-yaml/overcloud-images.yaml
|
||||||
|
- /usr/share/openstack-tripleo-common/image-yaml/overcloud-images-centos7.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Apache-2.0
|
18
roles/tripleo_overcloud_image_build/defaults/main.yml
Normal file
18
roles/tripleo_overcloud_image_build/defaults/main.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
# defaults file for tripleo_overcloud_image_build
|
||||||
|
openstack_bin: openstack
|
||||||
|
tripleo_overcloud_image_build_config_files: []
|
||||||
|
tripleo_overcloud_image_build_debug: false
|
||||||
|
tripleo_overcloud_image_build_dib_local_image:
|
||||||
|
tripleo_overcloud_image_build_dib_yum_repo_conf: "/etc/yum.repos.d/*"
|
||||||
|
tripleo_overcloud_image_build_extra_env_vars: {}
|
||||||
|
tripleo_overcloud_image_build_home_dir: "{{ ansible_env.HOME }}"
|
||||||
|
tripleo_overcloud_image_build_image_names: []
|
||||||
|
tripleo_overcloud_image_build_log_combine: true
|
||||||
|
tripleo_overcloud_image_build_log_output: true
|
||||||
|
tripleo_overcloud_image_build_no_skip: false
|
||||||
|
tripleo_overcloud_image_build_output_directory:
|
||||||
|
tripleo_overcloud_image_build_poll: 10
|
||||||
|
tripleo_overcloud_image_build_stable_branch:
|
||||||
|
tripleo_overcloud_image_build_timeout: 1800
|
||||||
|
tripleo_overcloud_image_build_log: "{{ tripleo_overcloud_image_build_home_dir }}/overcloud_image_build.log"
|
42
roles/tripleo_overcloud_image_build/meta/main.yml
Normal file
42
roles/tripleo_overcloud_image_build/meta/main.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2019 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: OpenStack
|
||||||
|
description: TripleO Operator Role -- tripleo_overcloud_image_build
|
||||||
|
company: Red Hat
|
||||||
|
license: Apache-2.0
|
||||||
|
min_ansible_version: 2.8
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
- name: CentOS
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
- 8
|
||||||
|
|
||||||
|
galaxy_tags:
|
||||||
|
- tripleo
|
||||||
|
|
||||||
|
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
|
dependencies: []
|
@ -0,0 +1,81 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
collections:
|
||||||
|
- tripleo.operator
|
||||||
|
vars:
|
||||||
|
tripleo_overcloud_image_build_log_output: false
|
||||||
|
tripleo_overcloud_image_build_log_combine: false
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: "Include tripleo_overcloud_image_build"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_image_build"
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_overcloud_image_build_debug: true
|
||||||
|
|
||||||
|
- name: Check role
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_image_build_result.stdout == "overcloud image build"
|
||||||
|
|
||||||
|
- name: Check parameter "tripleo_overcloud_image_build_config_files"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_image_build"
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_overcloud_image_build_debug: true
|
||||||
|
tripleo_overcloud_image_build_config_files:
|
||||||
|
- a.yaml
|
||||||
|
- b.yaml
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_image_build_config_files"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_image_build_result.stdout ==
|
||||||
|
"overcloud image build --config-file a.yaml --config-file b.yaml"
|
||||||
|
|
||||||
|
- name: Check parameter "tripleo_overcloud_image_build_image_names"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_image_build"
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_overcloud_image_build_debug: true
|
||||||
|
tripleo_overcloud_image_build_image_names:
|
||||||
|
- os
|
||||||
|
- ipa
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_image_build_image_names"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_image_build_result.stdout ==
|
||||||
|
"overcloud image build --image-name os --image-name ipa"
|
||||||
|
|
||||||
|
- name: Check parameter "tripleo_overcloud_image_build_no_skip"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_image_build"
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_overcloud_image_build_debug: true
|
||||||
|
tripleo_overcloud_image_build_no_skip: true
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_image_build_config_files"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_image_build_result.stdout ==
|
||||||
|
"overcloud image build --no-skip"
|
||||||
|
|
||||||
|
- name: Check parameter "tripleo_overcloud_image_build_output_directory"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_image_build"
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_overcloud_image_build_debug: true
|
||||||
|
tripleo_overcloud_image_build_output_directory: /foo
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_image_build_output_directory"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_image_build_result.stdout ==
|
||||||
|
"overcloud image build --output-directory /foo"
|
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: delegated
|
||||||
|
options:
|
||||||
|
managed: false
|
||||||
|
ansible_connection_options:
|
||||||
|
ansible_connection: local
|
||||||
|
log: true
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
scenario:
|
||||||
|
name: default
|
||||||
|
test_sequence:
|
||||||
|
- prepare
|
||||||
|
- syntax
|
||||||
|
- converge
|
||||||
|
- verify
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Include molecule prep
|
||||||
|
include_role:
|
||||||
|
name: test_molecule_prep
|
51
roles/tripleo_overcloud_image_build/tasks/main.yml
Normal file
51
roles/tripleo_overcloud_image_build/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
# tasks file for tripleo_overcloud_image_build
|
||||||
|
- name: Setup overcloud image build facts
|
||||||
|
set_fact:
|
||||||
|
_build_cmd: >-
|
||||||
|
{{ openstack_bin }} overcloud image build
|
||||||
|
{{ tripleo_overcloud_image_build_config_files | tripleo.operator.shell_arg_list('--config-file') }}
|
||||||
|
{{ tripleo_overcloud_image_build_image_names | tripleo.operator.shell_arg_list('--image-name') }}
|
||||||
|
{{ tripleo_overcloud_image_build_no_skip | ternary('--no-skip', '') }}
|
||||||
|
{{ tripleo_overcloud_image_build_output_directory | ternary('--output-directory ' ~ tripleo_overcloud_image_build_output_directory, '') }}
|
||||||
|
{{ tripleo_overcloud_image_build_log_output | ternary((">" ~ tripleo_overcloud_image_build_log), '') }}
|
||||||
|
{{ tripleo_overcloud_image_build_log_combine | ternary("2>&1", '') }}
|
||||||
|
_build_env: |
|
||||||
|
{% set env_vars = {} %}
|
||||||
|
{% if tripleo_overcloud_image_build_dib_yum_repo_conf %}
|
||||||
|
{% set _ = env_vars.update({'DIB_YUM_REPO_CONF': tripleo_overcloud_image_build_dib_yum_repo_conf}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if tripleo_overcloud_image_build_dib_local_image %}
|
||||||
|
{% set _ = env_vars.update({'DIB_LOCAL_IMAGE': tripleo_overcloud_image_build_dib_local_image}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if tripleo_overcloud_image_build_stable_branch %}
|
||||||
|
{% set _ = env_vars.update({'STABLE_BRANCH': tripleo_overcloud_image_build_stable_branch}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% set _ = env_vars.update(tripleo_overcloud_image_build_extra_env_vars) %}
|
||||||
|
{{ env_vars }}
|
||||||
|
|
||||||
|
- name: Show debugging information
|
||||||
|
when: tripleo_overcloud_image_build_debug|bool
|
||||||
|
block:
|
||||||
|
- name: Show the overcloud image build command
|
||||||
|
debug:
|
||||||
|
var: _build_cmd
|
||||||
|
|
||||||
|
- name: Show the overcloud image build environment
|
||||||
|
debug:
|
||||||
|
var: _build_env
|
||||||
|
|
||||||
|
- name: Preserve existing log file if exists
|
||||||
|
timestamp_file:
|
||||||
|
path: "{{ tripleo_overcloud_image_build_log }}"
|
||||||
|
when: tripleo_overcloud_image_build_log_output|bool
|
||||||
|
|
||||||
|
- name: Overcloud image build
|
||||||
|
shell: "{{ _build_cmd }}" # noqa 305
|
||||||
|
environment: "{{ _build_env }}"
|
||||||
|
args:
|
||||||
|
chdir: "{{ tripleo_overcloud_image_build_home_dir }}"
|
||||||
|
async: "{{ tripleo_overcloud_image_build_timeout }}"
|
||||||
|
poll: "{{ tripleo_overcloud_image_build_poll }}"
|
||||||
|
register: tripleo_overcloud_image_build_result
|
||||||
|
changed_when: true
|
1
roles/tripleo_overcloud_image_build/tests/inventory
Normal file
1
roles/tripleo_overcloud_image_build/tests/inventory
Normal file
@ -0,0 +1 @@
|
|||||||
|
localhost
|
4
roles/tripleo_overcloud_image_build/tests/test.yml
Normal file
4
roles/tripleo_overcloud_image_build/tests/test.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- tripleo_overcloud_image_build
|
@ -15,6 +15,7 @@
|
|||||||
- tripleo-operator-molecule-tripleo_overcloud_deploy
|
- tripleo-operator-molecule-tripleo_overcloud_deploy
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_export
|
- tripleo-operator-molecule-tripleo_overcloud_export
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_failures
|
- tripleo-operator-molecule-tripleo_overcloud_failures
|
||||||
|
- tripleo-operator-molecule-tripleo_overcloud_image_build
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_bios_configure
|
- tripleo-operator-molecule-tripleo_overcloud_node_bios_configure
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_clean
|
- tripleo-operator-molecule-tripleo_overcloud_node_clean
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_configure
|
- tripleo-operator-molecule-tripleo_overcloud_node_configure
|
||||||
@ -42,6 +43,7 @@
|
|||||||
- tripleo-operator-molecule-tripleo_overcloud_deploy
|
- tripleo-operator-molecule-tripleo_overcloud_deploy
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_export
|
- tripleo-operator-molecule-tripleo_overcloud_export
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_failures
|
- tripleo-operator-molecule-tripleo_overcloud_failures
|
||||||
|
- tripleo-operator-molecule-tripleo_overcloud_image_build
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_bios_configure
|
- tripleo-operator-molecule-tripleo_overcloud_node_bios_configure
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_clean
|
- tripleo-operator-molecule-tripleo_overcloud_node_clean
|
||||||
- tripleo-operator-molecule-tripleo_overcloud_node_configure
|
- tripleo-operator-molecule-tripleo_overcloud_node_configure
|
||||||
@ -151,6 +153,14 @@
|
|||||||
vars:
|
vars:
|
||||||
tox_extra_args: tripleo_overcloud_failures
|
tox_extra_args: tripleo_overcloud_failures
|
||||||
|
|
||||||
|
- job:
|
||||||
|
files:
|
||||||
|
- ^roles/tripleo_overcloud_image_build/.*
|
||||||
|
name: tripleo-operator-molecule-tripleo_overcloud_image_build
|
||||||
|
parent: tripleo-operator-molecule-base
|
||||||
|
vars:
|
||||||
|
tox_extra_args: tripleo_overcloud_image_build
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
files:
|
files:
|
||||||
- ^roles/tripleo_overcloud_node_bios_configure/.*
|
- ^roles/tripleo_overcloud_node_bios_configure/.*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user