tripleo-heat-templates/extraconfig/services/openshift-cns.yaml

162 lines
6.0 KiB
YAML

heat_template_version: rocky
description: External tasks definition for OpenShift
parameters:
RoleNetIpMap:
default: {}
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. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
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
OpenShiftGlusterNodeVars:
default: {}
description: OpenShift node vars specific for the gluster nodes
type: json
OpenShiftGlusterDisks:
default:
- /dev/vdb
description: List of disks for openshift_glusterfs service to use
type: comma_delimited_list
tags:
- role_specific
OpenShiftNodeGroupName:
default: node-config-all-in-one
description: The group the nodes belong to.
type: string
tags:
- role_specific
DockerOpenShiftGlusterFSImage:
description: Container image to use for GlusterFS pod
type: string
DockerOpenShiftGlusterFSBlockImage:
description: Container image to use for glusterblock-provisioner pod
type: string
DockerOpenShiftGlusterFSHeketiImage:
description: Container image to use for heketi pods
type: string
resources:
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- OpenShiftGlusterDisks: OpenShiftGlusterDisks
OpenShiftNodeGroupName: OpenShiftNodeGroupName
- values: {get_param: [RoleParameters]}
- values:
OpenShiftGlusterDisks: {get_param: OpenShiftGlusterDisks}
OpenShiftNodeGroupName: {get_param: OpenShiftNodeGroupName}
outputs:
role_data:
description: Role data for the Openshift Service
value:
# This service template essentially tags the nodes that we want
# as cns. The actual installation is performed in
# openshift-master service template.
service_name: openshift_glusterfs
upgrade_tasks: []
step_config: ''
external_deploy_tasks:
- name: openshift_cns step 2 Generate Inventory
when: step == '2'
block:
- name: set openshift global vars fact
set_fact:
openshift_gluster_disks: {get_attr: [RoleParametersValue, value, OpenShiftGlusterDisks]}
tripleo_node_group_name: {get_attr: [RoleParametersValue, value, OpenShiftNodeGroupName]}
tripleo_role_name: {get_param: RoleName}
- name: set openshift gluster global vars fact
set_fact:
openshift_gluster_global_vars:
map_merge:
- openshift_storage_glusterfs_storageclass_default: true
- {get_param: OpenShiftGlusterNodeVars}
- openshift_storage_glusterfs_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSImage}
openshift_storage_glusterfs_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSImage}
openshift_storage_glusterfs_block_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSBlockImage}
openshift_storage_glusterfs_block_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSBlockImage}
openshift_storage_glusterfs_heketi_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSHeketiImage}
openshift_storage_glusterfs_heketi_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSHeketiImage}
- name: generate openshift gluster global vars
copy:
dest: "{{playbook_dir}}/openshift/global_gluster_vars.yml"
content: "{{openshift_gluster_global_vars|to_nice_yaml}}"
- name: generate openshift inventory for Role
copy:
dest: "{{playbook_dir}}/openshift/inventory/{{tripleo_role_name}}_openshift_glusterfs.yml"
content: |
{% if tripleo_node_group_name == "node-config-infra" -%}
glusterfs_registry:
{% else -%}
glusterfs:
{% endif %}
hosts:
{% for host in groups[tripleo_role_name] | default([]) -%}
{{ hostvars.raw_get(host)['ansible_hostname'] }}:
glusterfs_ip: {{hostvars.raw_get(host)['storage_ip']}}
glusterfs_devices:
{{openshift_gluster_disks | to_nice_yaml() | indent(8) }}
{% endfor %}