tripleo-heat-templates/deployment/heat/heat-ephemeral-container-ansible.yaml
Alex Schultz ebab335f38 Role specific container support
We may want to be able to specific different containers at a role level.
This requires switching the container image parameters to be role
specific too allow for role based overrides.

Change-Id: I4090e889a32abd51e7c11139737a7a18e27d18e7
2022-01-21 14:18:02 -07:00

179 lines
6.7 KiB
YAML

heat_template_version: wallaby
description: >
Openstack Heat Ephemeral service, provides nothing but container images
parameters:
ContainerHeatAllImage:
description: The container image to use for heat-all
type: string
tags:
- role_specific
ContainerHeatEngineImage:
description: image
type: string
tags:
- role_specific
ContainerHeatConfigImage:
description: The container image to use for the heat config_volume
type: string
tags:
- role_specific
ContainerHeatApiImage:
description: image
type: string
tags:
- role_specific
ContainerHeatApiConfigImage:
description: The container image to use for the heat_api config_volume
type: string
tags:
- role_specific
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
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
OvercloudStackRoleDataFileMap:
default: {}
description: |
Mapping of overcloud stack name, and the absolute path to the
roles data file used when deploying/updating the stack.
For example: {'overcloud': '/home/stack/roles_data.yaml'}
type: json
resources:
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- ContainerHeatAllImage: ContainerHeatAllImage
ContainerHeatEngineImage: ContainerHeatEngineImage
ContainerHeatConfigImage: ContainerHeatConfigImage
ContainerHeatApiImage: ContainerHeatApiImage
ContainerHeatApiConfigImage: ContainerHeatApiConfigImage
- values: {get_param: [RoleParameters]}
- values:
ContainerHeatAllImage: {get_param: ContainerHeatAllImage}
ContainerHeatEngineImage: {get_param: ContainerHeatEngineImage}
ContainerHeatConfigImage: {get_param: ContainerHeatConfigImage}
ContainerHeatApiImage: {get_param: ContainerHeatApiImage}
ContainerHeatApiConfigImage: {get_param: ContainerHeatApiConfigImage}
outputs:
role_data:
description: Role data for the Heat Ephemeral
value:
service_name: heat_ephemeral
deploy_steps_tasks:
- name: Tag Ephemeral Heat Containers for Overcloud Deploy
when:
- step|int == 5
block:
- name: Tag Heat All image
import_role:
name: tripleo_container_tag
vars:
container_image: {get_attr: [RoleParametersValue, value, ContainerHeatAllImage]}
container_image_latest: "localhost/tripleo/openstack-heat-all:ephemeral"
- name: Tag Heat Engine image
import_role:
name: tripleo_container_tag
vars:
container_image: {get_attr: [RoleParametersValue, value, ContainerHeatEngineImage]}
container_image_latest: "localhost/tripleo/openstack-heat-engine:ephemeral"
- name: Tag Heat Api image
import_role:
name: tripleo_container_tag
vars:
container_image: {get_attr: [RoleParametersValue, value, ContainerHeatApiImage]}
container_image_latest: "localhost/tripleo/openstack-heat-api:ephemeral"
external_deploy_tasks:
- name: Manage clouds.yaml file for ephemeral Heat
when:
- step|int == 1
- not ansible_check_mode|bool
block:
- name: Create /etc/openstack directory if it does not exist
become: true
file:
mode: '0755'
owner: root
path: /etc/openstack
state: directory
- name: Configure /etc/openstack/clouds.yaml for ephemeral Heat
include_role:
name: tripleo_keystone_resources
tasks_from: clouds
vars:
tripleo_keystone_resources_cloud_name: heat
tripleo_keystone_resources_cloud_config:
auth_type: none
endpoint: http://127.0.0.1:8006/v1/admin
upgrade_tasks:
- name: Convert to Ephemeral Heat
when:
- step|int == 1
block:
- name: Create /var/lib/tripleo-config/scripts dir
file:
path: /var/lib/tripleo-config/scripts
state: directory
recurse: true
- name: Copy undercloud-upgrade-ephemeral-heat.py to /var/lib/tripleo-config/scripts
copy:
dest: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
content: {get_file: ../../scripts/undercloud-upgrade-ephemeral-heat.py}
mode: 0755
- name: Check if heat engine is still running
shell: systemctl is-active tripleo_heat_engine.service || systemctl is-enabled tripleo_heat_engine.service
failed_when: false
become: true
register: heat_engine_enabled
- name: Store OvercloudStackRoleDataFileMap on file
vars:
role_data_file_map: {get_param: OvercloudStackRoleDataFileMap}
copy:
dest: /var/lib/tripleo-config/overcloud-stack-role-data-file-map.yaml
content: "{{ role_data_file_map | to_nice_yaml }}"
- name: Run undercloud-upgrade-ephemeral-heat.py
shell: /var/lib/tripleo-config/scripts/undercloud-upgrade-ephemeral-heat.py
register: upgrade_ephemeral_result
when:
- heat_engine_enabled.rc is defined
- heat_engine_enabled.rc == 0
- name: Tear down previous Heat containers
include_role:
name: tripleo_container_rm
vars:
tripleo_container_cli: "{{ container_cli }}"
tripleo_containers_to_rm:
- heat_api
- heat_api_cfn
- heat_engine
when:
- upgrade_ephemeral_result.rc is defined
- upgrade_ephemeral_result.rc == 0