Browse Source

Use Ansible for all_nodes hieradata

Migrate the generation of the all_nodes hieradata from Heat to using the
tripleo-hieradata role instead.

Change-Id: I9a37d1faec73a81a28d8f89d86375fb15ee765c7
Depends-On: I6e1e1c28dc09c9e04119db910068d62409a5afc8
changes/13/665213/20
James Slagle 2 years ago
parent
commit
4c34147cc1
  1. 2
      common/deploy-steps-tasks.yaml
  2. 224
      common/deploy-steps.j2
  3. 5
      environments/standalone/standalone-tripleo.yaml
  4. 5
      environments/undercloud/undercloud-minion.yaml
  5. 114
      network/ports/net_ip_list_map.j2.yaml
  6. 51
      overcloud.j2.yaml
  7. 122
      puppet/all-nodes-config.j2.yaml
  8. 3
      sample-env-generator/standalone.yaml
  9. 3
      sample-env-generator/undercloud-minion.yaml

2
common/deploy-steps-tasks.yaml

@ -530,7 +530,7 @@
set_fact:
host_container_puppet_tasks: "{{host_container_puppet_tasks|default([]) + [item]}}"
loop: "{{container_puppet_tasks.get('step_' + step, [])}}"
when: vars[item.service_name + '_short_bootstrap_node_name'] == ansible_hostname
when: (groups[item.service_name] | default ([]) | map('extract', hostvars, 'inventory_hostname') | first) == ansible_hostname
vars:
container_puppet_tasks: "{{ lookup('file', tripleo_role_name + '/container_puppet_tasks.yaml', errors='ignore') | default({}, True) | from_yaml }}"
tags:

224
common/deploy-steps.j2

@ -171,6 +171,23 @@ parameters:
AnsibleHostVarsMap:
type: json
default: {}
StackUpdateType:
type: string
description: >
Type of update, to differentiate between UPGRADE and UPDATE cases
when StackAction is UPDATE (both are the same stack action).
constraints:
- allowed_values: ['', 'UPGRADE', 'FASTFORWARDUPGRADE']
default: ''
ContainerCli:
type: string
default: 'podman'
description: CLI tool used to manage containers.
constraints:
- allowed_values: ['docker', 'podman']
EnabledServices:
default: []
type: comma_delimited_list
conditions:
{% for role in enabled_roles %}
@ -304,6 +321,11 @@ outputs:
stack_action: {get_param: StackAction}
deploy_artifact_urls: {list_join: [' ', {get_param: DeployArtifactURLs}]}
hosts_entry: {get_param: HostsEntry}
primary_role_name: {{ primary_role_name }}
deploy_identifier: {get_param: DeployIdentifier}
stack_update_type: {get_param: StackUpdateType}
container_cli: {get_param: ContainerCli}
enabled_services: {get_param: EnabledServices}
common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
docker_puppet_script: {get_file: ./container-puppet.py}
all_nodes_validation_script.sh : {get_file: ../validation-scripts/all-nodes.sh}
@ -347,6 +369,36 @@ outputs:
tags:
- always
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
- hosts: all
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
name: Manage SELinux
@ -413,6 +465,7 @@ outputs:
hieradata_variable_end_string: $$
hieradata_files: "{{ '{{' }} lookup('file', '{{role.name}}/deployment-hierarchy.yaml') {{ '}}' }}"
when: tripleo_role_name == '{{role.name}}'
- name: Deployment hieradata
include_role:
name: tripleo-hieradata
@ -451,6 +504,7 @@ outputs:
vars:
hieradata_templates_list:
- bootstrap_node
- all_nodes
when: tripleo_role_name == '{{role.name}}'
tags:
- overcloud
@ -745,6 +799,34 @@ outputs:
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
{%- for role in roles %}
- hosts: {{role.name}}
name: Run update
@ -807,6 +889,34 @@ outputs:
- include_vars: global_vars.yaml
tags:
- always
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
- hosts: DEPLOY_SOURCE_HOST
name: External update steps
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
@ -860,6 +970,34 @@ outputs:
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
- hosts: {{role.name}}
name: Run pre-upgrade rolling tasks
serial: {{ role.deploy_serial | default(1) }}
@ -907,9 +1045,35 @@ outputs:
warn: no
tags:
- always
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
{%- for step in range(0,upgrade_steps_max) %}
- hosts: DEPLOY_TARGET_HOST
name: Upgrade tasks for step {{step}}
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
@ -1009,6 +1173,34 @@ outputs:
- include_vars: global_vars.yaml
tags:
- always
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
- hosts: DEPLOY_SOURCE_HOST
name: External upgrade
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
@ -1108,6 +1300,34 @@ outputs:
- include_vars: global_vars.yaml
tags:
- always
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
block:
- name: Get current user
command: whoami
register: whoami
- name: render all_nodes data as group_vars for overcloud
template:
src: "{{ '{{' }} lookup('first_found', lookup('config', 'DEFAULT_ROLES_PATH') | map('regex_replace', '$', '/tripleo-hieradata') | list) ~ '/templates/all_nodes.j2' {{ '}}'}}"
dest: "{{ '{{' }} playbook_dir {{ '}}' }}/group_vars/overcloud.json"
owner: "{{ '{{' }} whoami.stdout {{ '}}' }}"
group: "{{ '{{' }} whoami.stdout {{ '}}' }}"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ '{{ ' }} playbook_dir {{ ' }}' }}/group_vars/overcloud.json"
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Scaling
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}

5
environments/standalone/standalone-tripleo.yaml

@ -48,11 +48,6 @@ parameter_defaults:
# Type: boolean
SshFirewallAllowAll: True
# Heat action on performed top-level stack. Note StackUpdateType is set to UPGRADE when a major-version upgrade is in progress.
# Mandatory. This parameter must be set by the user.
# Type: string
StackAction: CREATE
# How many replicas to use in the swift rings.
# Type: number
SwiftReplicas: 1

5
environments/undercloud/undercloud-minion.yaml

@ -28,11 +28,6 @@ parameter_defaults:
# Type: boolean
SshFirewallAllowAll: True
# Heat action on performed top-level stack. Note StackUpdateType is set to UPGRADE when a major-version upgrade is in progress.
# Mandatory. This parameter must be set by the user.
# Type: string
StackAction: CREATE
resource_registry:
OS::TripleO::Network::Ports::ControlPlaneVipPort: OS::Heat::None
OS::TripleO::Services::AodhApi: OS::Heat::None

114
network/ports/net_ip_list_map.j2.yaml

@ -72,39 +72,12 @@ resources:
{{network.name_lower}}: {get_param: {{network.name}}NetName}
{%- endfor %}
ServicesIpData:
type: OS::Heat::Value
depends_on: EnabledServicesValue
properties:
value:
map_merge:
repeat:
template:
# $$ is used here to indicate the start/end of an ansible jinja
# expression. we could use {{ and }} but the escaping would make it
# difficult to read, and it would still come out surrounded by
# quotes. On the ansible side,
# we then set variable_start_string/variable_end_string to $$ for
# use with the template module
SERVICE_node_ips: $$ groups['SERVICE'] | default ([]) | map('extract', hostvars, service_net_map['SERVICE_network'] | default('ctlplane') ~ '_ip') | list | to_json $$
for_each:
SERVICE:
yaql:
expression: let(root => $) -> coalesce($root.data.enabled_services, []).where($root.data.service_net_map.keys().contains($ + "_network"))
data:
service_net_map: {get_param: ServiceNetMap}
enabled_services: {get_attr: [EnabledServicesValue, value]}
outputs:
net_ip_map:
description: >
A Hash containing a mapping of network names to assigned lists
of IP addresses.
value: {get_attr: [NetIpMapValue, value]}
service_ips:
description: >
Map of enabled services to a list of their IP addresses
value: {get_attr: [ServicesIpData, value]}
ctlplane_service_ips:
description: >
Map of enabled services to a list of their ctlplane IP addresses
@ -115,90 +88,3 @@ outputs:
SERVICE_ctlplane_node_ips: $$ groups['SERVICE'] | default ([]) | map('extract', hostvars, 'ctlplane_ip') | list | to_json $$
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
service_hostnames:
description: >
Map of enabled services to a list of hostnames where they're running
value:
map_replace:
- yaql:
# This filters any entries where the value hasn't been substituted for
# a list, e.g it's still $service_network. This happens when there is
# no network defined for the service in the ServiceNetMap, which is OK
# as not all services have to be bound to a network, so we filter them
expression: dict($.data.map.items().where(not $[1].endsWith("_network")))
data:
map:
map_replace:
- map_merge:
if:
- is_cell
-
repeat:
template:
SERVICE_cell_node_names: SERVICE_network
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
-
repeat:
template:
SERVICE_node_names: SERVICE_network
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
- values: {get_param: ServiceNetMap}
- values: {get_param: NetworkHostnameMap}
short_service_hostnames:
description: >
Map of enabled services to a list of hostnames where they're running regardless of the network
value:
yaql:
# If ServiceHostnameList is empty the role is deployed with zero nodes
# therefore we don't want to add any *_node_names to the map
expression: dict($.data.map.items().where(len($[1]) > 0))
data:
map:
map_merge:
repeat:
template:
SERVICE_short_node_names: {get_param: ServiceHostnameList}
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
short_service_bootstrap_hostnames:
description: >
Map of enabled services to a list of hostnames where they're running regardless of the network
Used for bootstrap purposes
value:
yaql:
# If ServiceHostnameList is empty the role is deployed with zero nodes
# therefore we don't want to add any *_node_names to the map
expression: dict($.data.map.items().where(len($[1]) > 0))
data:
map:
map_merge:
repeat:
template:
SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList}
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
service_bootstrap_ips:
description: >
Map of enabled services to a list of their IP addresses
Used for bootstrap purposes
value:
yaql:
# This filters any entries where the value hasn't been substituted for
# a list, e.g it's still $service_network. This happens when there is
# no network defined for the service in the ServiceNetMap, which is OK
# as not all services have to be bound to a network, so we filter them
expression: dict($.data.map.items().where(not isString($[1])))
data:
map:
map_replace:
- map_replace:
- map_merge:
repeat:
template:
SERVICE_bootstrap_node_ip: SERVICE_network
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
- values: {get_param: ServiceNetMap}
- values: {get_attr: [NetIpMapValue, value]}

51
overcloud.j2.yaml

@ -786,51 +786,10 @@ resources:
- ','
{%- for role in roles %}
- {get_attr: [{{role.name}}ServiceNames, value]}
{%- endfor %}
controller_ips: {get_attr: [{{primary_role_name}}, ip_address]}
controller_names: {get_attr: [{{primary_role_name}}, hostname]}
service_ips:
map_merge:
{%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_ips]}
{%- endfor %}
service_node_names:
yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data:
l:
{%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_hostnames]}
{%- endfor %}
short_service_node_names:
yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data:
l:
{%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, short_service_hostnames]}
{%- endfor %}
short_service_bootstrap_node:
yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first()]))
data:
l:
{%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, short_service_bootstrap_hostnames]}
{%- endfor %}
service_bootstrap_node_ip:
yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first(null)]))
data:
l:
{%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_bootstrap_ips]}
{%- endfor %}
NetVipMap: {get_attr: [VipMap, net_ip_map]}
RedisVirtualIP: {get_attr: [RedisVirtualIP, ip_address]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
DeployIdentifier: {get_param: DeployIdentifier}
UpdateIdentifier: {get_param: UpdateIdentifier}
{%- endfor %}
GlobalConfig:
@ -1094,6 +1053,11 @@ resources:
{%- for role in roles %}
{{role.name}}HieradataVars: {get_attr: [{{role.name}}HieradataVars, value]}
{%- endfor %}
EnabledServices:
list_concat:
{%- for role in roles %}
- {get_attr: [{{role.name}}ServiceNames, value]}
{%- endfor %}
DeployedServerEnvironment:
type: OS::TripleO::DeployedServerEnvironment
@ -1207,11 +1171,6 @@ outputs:
BlacklistedIpAddresses:
description: List of blacklisted ctlplane IP addresses
value: {get_attr: [BlacklistedIpAddresses, value]}
# We can use the AllNodesConfig from the primary role here as this part of
# the allNodesConfig is the same for all roles.
AllNodesConfig:
description: The config (hieradata) for all nodes.
value: {get_attr: [{{primary_role_name}}allNodesConfig, all_nodes_config]}
GlobalConfig:
description: The global_config (hieradata).
value: {get_attr: [GlobalConfig, value]}

122
puppet/all-nodes-config.j2.yaml

@ -14,20 +14,6 @@ parameters:
type: string
enabled_services:
type: comma_delimited_list
controller_ips:
type: comma_delimited_list
service_ips:
type: json
service_node_names:
type: json
short_service_node_names:
type: json
short_service_bootstrap_node:
type: json
service_bootstrap_node_ip:
type: json
controller_names:
type: comma_delimited_list
NetVipMap:
type: json
RedisVirtualIP:
@ -35,33 +21,6 @@ parameters:
default: ''
ServiceNetMap:
type: json
DeployIdentifier:
type: string
default: ''
description: >
Setting this to a unique value will re-run any deployment tasks which
perform configuration on a Heat stack-update.
UpdateIdentifier:
type: string
default: ''
description: >
Setting to a previously unused value during stack-update will trigger
package update on all nodes
StackAction:
type: string
description: >
Heat action on performed top-level stack. Note StackUpdateType is
set to UPGRADE when a major-version upgrade is in progress.
constraints:
- allowed_values: ['CREATE', 'UPDATE']
StackUpdateType:
type: string
description: >
Type of update, to differentiate between UPGRADE and UPDATE cases
when StackAction is UPDATE (both are the same stack action).
constraints:
- allowed_values: ['', 'UPGRADE', 'FASTFORWARDUPGRADE']
default: ''
EnableInternalTLS:
type: boolean
default: false
@ -76,91 +35,15 @@ parameters:
description: The name of the {{network.name_lower}} network.
type: string
{%- endfor %}
ContainerCli:
type: string
default: 'podman'
description: CLI tool used to manage containers.
constraints:
- allowed_values: ['docker', 'podman']
resources:
allNodesConfigValue:
type: OS::Heat::Value
properties:
value:
yaql:
expression: $.data.all_nodes_extra_map_data.mergeWith($.data.all_nodes)
data:
all_nodes_extra_map_data: {get_param: AllNodesExtraMapData}
all_nodes:
map_merge:
- enabled_services:
yaql:
expression: $.data.distinct()
data: {get_param: enabled_services}
# This writes out a mapping of service_name_enabled: 'true'
# For any services not enabled, hiera foo_enabled will
# return nil, as it's undefined
- map_merge:
repeat:
template:
# Note this must be string 'true' due to
# https://bugs.launchpad.net/heat/+bug/1617203
SERVICE_enabled: 'true'
for_each:
SERVICE: {get_param: enabled_services}
# Dynamically generate per-service network data
# This works as follows (outer->inner functions)
# yaql - filters services where no mapping exists in ServiceNetMap
# map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
# map_merge/repeat: generate a per-service mapping
- yaql:
# This filters any entries where the value hasn't been substituted for
# a list, e.g it's still $service_network. This happens when there is
# no network defined for the service in the ServiceNetMap, which is OK
# as not all services have to be bound to a network, so we filter them
expression: dict($.data.map.items().where(isString($[1]) and not $[1].endsWith("_network")))
data:
map:
map_replace:
- map_merge:
repeat:
template:
SERVICE_network: SERVICE_network
for_each:
SERVICE: {get_param: enabled_services}
- values: {get_param: ServiceNetMap}
# Keystone doesn't provide separate entries for the public
# and admin endpoints, so we need to add them here manually
# like we do in the vip-config below
- keystone_admin_api_network: {get_param: [ServiceNetMap, keystone_admin_api_network]}
keystone_public_api_network: {get_param: [ServiceNetMap, keystone_public_api_network]}
# provides a mapping of service_name_ips to a list of IPs
- {get_param: service_ips}
- {get_param: service_node_names}
- {get_param: short_service_node_names}
- {get_param: short_service_bootstrap_node}
- {get_param: service_bootstrap_node_ip}
- controller_node_ips:
list_join:
- ','
- {get_param: controller_ips}
controller_node_names:
list_join:
- ','
- {get_param: controller_names}
deploy_identifier: {get_param: DeployIdentifier}
stack_action: {get_param: StackAction}
stack_update_type: {get_param: StackUpdateType}
container_cli: {get_param: ContainerCli}
allNodesConfigDatafiles:
type: OS::Heat::Value
properties:
value:
datafiles:
all_nodes: {get_attr: [allNodesConfigValue, value]}
all_nodes_extra_map_data: {get_parm: AllNodesExtraMapData}
vip_data:
map_merge:
# Dynamically generate per-service VIP data based on enabled_services
@ -248,9 +131,6 @@ outputs:
description: The ID of the allNodesConfigImpl resource.
value:
{get_resource: allNodesConfigImpl}
all_nodes_config:
description: The all_nodes hieradata config
value: {get_attr: [allNodesConfigValue, value]}
all_nodes_config_hieradata:
description: The all_nodes config in the full format with datafiles section.
value: {get_attr: [allNodesConfigDatafiles, value]}

3
sample-env-generator/standalone.yaml

@ -43,9 +43,6 @@ environments:
parameters:
- SoftwareConfigTransport
- DnsServers
puppet/all-nodes-config.yaml:
parameters:
- StackAction
sample-env-generator/standalone.yaml:
parameters:
- AddVipsToEtcHosts

3
sample-env-generator/undercloud-minion.yaml

@ -24,9 +24,6 @@ environments:
parameters:
- SoftwareConfigTransport
- DnsServers
puppet/all-nodes-config.yaml:
parameters:
- StackAction
sample_values:
# Normal bits for standalone
StackAction: CREATE

Loading…
Cancel
Save