Add image prepare default role

Adds tripleo-container-image-prepare-default role to run the prepare
default command to generate ContainerImageParameters.

Change-Id: If5e8e75f5a572660a5aeed13c1b60bc5ea27032f
This commit is contained in:
Alex Schultz
2020-01-15 15:23:45 -07:00
committed by Sagi Shnaidman
parent 2ac548a35b
commit aadb9f4be3
6 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
tripleo-container-image-prepare-default
============================
A role to perform the container image push against a registry.
Requirements
------------
None.
Role Variables
--------------
* `tripleo_container_image_prepare_default_debug`: (Boolean) Flag to print out the push command. Default: False
* `tripleo_container_image_prepare_default_local_push_destination`: (Boolean) Include a push_Destination to trigger upload to a local registry on the undercloud. Default: false
* `tripleo_container_image_prepare_default_output_env_file`: (String) File to write environment file containing default ContainerImagePrepare value. When not set, `tripleo_container_image_prepare_default_output` will contain yaml defining ContainerImagePrepare. Default is not set.
Output Variables
----------------
* `tripleo_container_image_prepare_default_output`: (String) YAML defining a default ContainerImagePrepare value.
* `tripleo_container_image_prepare_default_result`: Ansible execution results
Dependencies
------------
None.
Example Playbook
----------------
Example container prepare default execution playbook
- hosts: undercloud
gather_facts: true
tasks:
- name: Generate default ContainerImagePrepare
import_role:
name: tripleo-container-image-prepare-default
vars:
tripleo_container_image_prepare_output_env_file: /home/stack/container-image-prepare.yaml
License
-------
Apache-2.0

View File

@@ -0,0 +1,13 @@
---
# defaults file for tripleo-container-image-push
tripleo_container_image_push_append_tag:
tripleo_container_image_push_become: true
tripleo_container_image_push_cleanup: false
tripleo_container_image_push_debug: false
tripleo_container_image_push_dry_run: false
tripleo_container_image_push_local: false
tripleo_container_image_push_multi_arch: false
tripleo_container_image_push_password:
tripleo_container_image_push_registry_url:
tripleo_container_image_push_timeout: 360
tripleo_container_image_push_username:

View 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-container-image-prepare-default
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: []

View File

@@ -0,0 +1,23 @@
---
# tasks file for tripleo-container-image-prepare-default
- name: Setup container image prepare default facts
set_fact:
_prepare_cmd: >-
openstack tripleo container image prepare default
{{ tripleo_container_image_prepare_default_output_env_file | ternary('--output-env-file '
~ tripleo_container_image_prepare_default_output_env_file, '') }}
{{ tripleo_container_image_prepare_default_local_push_destination | ternary('--local-push-destination', '') }}
- name: Show the container image push command
debug:
var: _prepare_cmd
when: tripleo_container_image_prepare_default_debug|bool
- name: Container image push
shell: "{{ _prepare_cmd }}" # noqa 305
register: tripleo_container_image_prepare_default_result
changed_when: true
- name: Set output variable
set_fact:
tripleo_container_image_prepare_default_result: "{{ tripleo_container_image_prepare_default_result.stdout }}"

View File

@@ -0,0 +1,2 @@
localhost

View File

@@ -0,0 +1,6 @@
---
- hosts: localhost
roles:
- tripleo-container-image-prepare-default
vars:
tripleo_container_image_prepare_default_output_env_file: "{{ ansible_env.HOME }}/container-image-prepare.yaml }}"