Sort bootstrap node check for container_puppet_tasks

Previously, the task that checks if container_puppet_tasks should be
written to the bootstrap node was not sorted, which meant the order was
undefined coming out of the Ansible inventory.

This patch adds a sort filter to the check so that by convention the
first node is chosen from the inventory.

A variable, sorted_bootstrap_node, is also added to control the sorting
in the bootstrap_node.j2 template from the tripleo-hieradata role so
that the tripleo-ansible patch is able to merge first.

Depends-On: I3d595ea5b84f940a3b2dbc69798f69fe03529c10

Change-Id: I6b93f5b0747c5a11d24615a3bbb5516f9be81401
This commit is contained in:
James Slagle 2019-08-23 18:04:37 -04:00
parent 4fd8c17f03
commit e995415d86
2 changed files with 2 additions and 1 deletions

View File

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

View File

@ -366,6 +366,7 @@ outputs:
enable_internal_tls: {get_param: EnableInternalTLS}
cloud_domain: {get_param: CloudDomain}
all_nodes_extra_map_data: {get_param: AllNodesExtraMapData}
sorted_bootstrap_node: true
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}