tripleo-heat-templates/deployment/container-image-prepare/container-image-prepare-baremetal-ansible.j2.yaml
Takashi Kajinami 3dd4107b13 Support role specific ContainerImagePrepare
This implements partial support for overriding the ContainerImaePrepare
parameter for individual roles, so that users can use different set
of images for each role.

example:
parameter_defaults:
  ContainerImagePrepare:
    - push_destination: true
      set:
        name_prefix: openstack-
        name_suffix: ''
        namespace: quay.io/repository/tripleowallabycentos9
        ...
  ComputeEl8ContainerImagePrepare:
    - push_destination: true
      set:
        name_prefix: openstack-
        name_suffix: ''
        namespace: quay.io/repository/tripleowallabycentos8
        ...

This change ensures that container image prepare process, which is
executed by external tasks, pulls container images according to these
layer definitions so that the required container images are downloaded
and pushed to the undercloud image-server during deployment.

Depends-on: https://review.opendev.org/c/openstack/tripleo-ansible/+/851689
Change-Id: I7c96d7d0f23fd999e76b417f456ac6a2764c4a3e
2022-08-02 03:51:48 +00:00

135 lines
4.9 KiB
YAML

heat_template_version: wallaby
description: >
Prepare container images
parameters:
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. Use
parameter_merge_strategies to merge it with the defaults.
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
ContainerImagePrepare:
default: {}
description: Used to run "openstack tripleo container image prepare".
This is run after the registry is installed to populate
the registry with images.
type: json
ContainerImagePrepareLogFile:
default: '/var/log/tripleo-container-image-prepare.log'
type: string
description: Used to store outputs of "openstack tripleo container image prepare".
DockerInsecureRegistryAddress:
description: Optional. The IP Address and Port of an insecure docker
namespace that will be configured in /etc/sysconfig/docker.
The value can be multiple addresses separated by commas.
type: comma_delimited_list
default: []
NeutronMechanismDrivers:
default: 'ovn'
description: |
The mechanism drivers for the Neutron tenant network.
type: comma_delimited_list
DockerRegistryMirror:
description: Optional. Mirror to use for registry docker.io
default: ''
type: string
Debug:
default: false
description: Set to True to enable debugging on all services.
type: boolean
ContainerImagePrepareDebug:
default: false
description: Whether or not we want to activate --debug in tripleo container image prepare.
type: boolean
ContainerImageRegistryCredentials:
type: json
hidden: true
default: {}
description: |
Mapping of image registry hosts to login credentials. Must be in the following example format
docker.io:
username: pa55word
'192.0.2.1:8787':
registry_username: password
AdditionalArchitectures:
default: []
description: List of additional architectures to enable.
type: comma_delimited_list
{% for role in roles %}
{{ role.name }}ContainerImagePrepare:
description: Used to run "openstack tripleo container image prepare".
This is run after the registry is installed to populate
the registry with images. This is used for a specific role and
replaces the ContainerImagePrepare parameter.
type: json
default: {}
# Parameters generated for {{role.name}} Role
{{ role.name }}Services:
description: A list of service resources (configured in the Heat
resource_registry) which represent nested stacks
for each service that should get installed on the {{role.name}} role.
type: comma_delimited_list
{{ role.name }}Count:
description: Number of {{role.name}} nodes to deploy
type: number
default: {{role.CountDefault|default(0)}}
{% endfor %}
outputs:
role_data:
description: Role data for container image prepare
value:
service_name: container_image_prepare
external_deploy_tasks:
- name: Run tripleo-container-image-prepare role
import_role:
name: tripleo_container_image_prepare
vars:
tripleo_container_image_prepare_log_file: {get_param: ContainerImagePrepareLogFile}
tripleo_container_image_prepare_debug:
if:
- {get_param: ContainerImagePrepareDebug}
- true
- {get_param: Debug}
tripleo_container_image_prepare_roles: {{ roles }}
tripleo_container_image_prepare_content:
parameter_defaults:
ContainerImagePrepare: {get_param: ContainerImagePrepare}
DockerInsecureRegistryAddress: {get_param: DockerInsecureRegistryAddress}
NeutronMechanismDrivers: {get_param: NeutronMechanismDrivers}
DockerRegistryMirror: {get_param: DockerRegistryMirror}
ContainerImageRegistryCredentials: {get_param: ContainerImageRegistryCredentials}
AdditionalArchitectures: {get_param: AdditionalArchitectures}
{% for role in roles %}
{{ role.name }}ContainerImagePrepare: {get_param: {{role.name}}ContainerImagePrepare}
{{ role.name }}Services: {get_param: {{role.name}}Services}
{{ role.name }}Count: {get_param: {{role.name}}Count}
{% endfor %}
when:
- (step | int) == 1