Browse Source

Deployment: Properly pick bootstrap node per role

Previous logic for identifying bootstrap node results in broken
deployments where bootstrap tasks have to run also on other node
than just controller-0. This fix is queens only.

Change-Id: I752441565641ef85f7ac0d8f2d7234a6630c0e3f
Resolves: rhbz#1599764
Closes-Bug: #1828590
changes/89/658389/1
Lukas Bezdicka 2 years ago
parent
commit
181ecb583f
  1. 30
      common/deploy-steps-tasks.yaml

30
common/deploy-steps-tasks.yaml

@ -1,5 +1,17 @@
# Note the indentation here is required as it's joined
# to create a playbook in deploy-steps.j2
# Identify if we are bootstrap node of this role
# We expect hieradata was already written in pre_deployments
- name: get bootstrap nodeid
tags: common
command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
register: bootstrap_node
- name: set is_bootstrap_node fact
tags: common
set_fact:
is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
##################################################
# Step 1 block, write data for subsequent steps
##################################################
@ -201,9 +213,9 @@
tags:
- container_startup_configs
########################################################
# Bootstrap tasks, only performed on bootstrap_server_id
########################################################
###############################################################
# Bootstrap tasks, only performed on bootstrap node of the role
###############################################################
- name: Clean /var/lib/docker-puppet/docker-puppet-tasks*.json files
file:
@ -211,7 +223,7 @@
state: absent
with_fileglob:
- /var/lib/docker-puppet/docker-puppet-tasks*.json
when: deploy_server_id == bootstrap_server_id
when: is_bootstrap_node|bool
tags:
- container_config_tasks
@ -237,7 +249,7 @@
loop: "{{ role_data_docker_puppet_tasks | dictsort }}"
loop_control:
label: "{{ item[0] }}"
when: deploy_server_id == bootstrap_server_id
when: is_bootstrap_node|bool
tags:
- container_config_tasks
@ -339,9 +351,9 @@
tags:
- container_startup_configs
########################################################
# Bootstrap tasks, only performed on bootstrap_server_id
########################################################
###############################################################
# Bootstrap tasks, only performed on bootstrap node of the role
###############################################################
- name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json exists
stat:
@ -358,7 +370,7 @@
NET_HOST: "true"
NO_ARCHIVE: "true"
STEP: "{{step}}"
when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
when: is_bootstrap_node|bool and docker_puppet_tasks_json.stat.exists
changed_when: false
check_mode: no
register: outputs

Loading…
Cancel
Save