Revert "Use YAML anchors/aliases to reduce playbook task repetition"

This reverts commit bc4df9c5a9.

These don't always exist in the the same file because of
the usage of template. Some of these work but the updates
is broken now.

Change-Id: Id45eee817aff0a780f0fc2da2453bb8fec66d380
Closes-Bug: #1861335
This commit is contained in:
Alex Schultz 2020-01-29 21:04:51 +00:00 committed by Wes Hayutin
parent c350126be0
commit 1f98e96d35
1 changed files with 202 additions and 44 deletions

View File

@ -421,8 +421,7 @@ outputs:
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
SELINUX_MODE: {get_param: SELinuxMode}
template: |
- &gather_facts_undercloud
hosts: DEPLOY_SOURCE_HOST
- hosts: DEPLOY_SOURCE_HOST
name: Gather facts from undercloud
gather_facts: yes
any_errors_fatal: yes
@ -430,40 +429,24 @@ outputs:
tags:
- facts
- &gather_facts_overcloud
hosts: DEPLOY_TARGET_HOST
- hosts: DEPLOY_TARGET_HOST
name: Gather facts from overcloud
gather_facts: yes
any_errors_fatal: yes
tags:
- facts
- &load_global_variables
hosts: all
- hosts: all
name: Load global variables
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
tasks:
- include_vars: global_vars.yaml
no_log: true
- name: ensure we get the right selinux context
shell: |-
set -o pipefail
if [[ -e /var/lib/config-data ]]; then
chcon -R -t svirt_sandbox_file_t /var/lib/config-data
exit 2
fi
args:
executable: /bin/bash
warn: no
register: _selinux_config_data
changed_when: _selinux_config_data.rc == 2
failed_when: _selinux_config_data.rc not in [0,2]
tags:
- always
- &render_overcloud_group_vars
hosts: DEPLOY_TARGET_HOST
- hosts: DEPLOY_TARGET_HOST
name: Render all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
@ -486,8 +469,7 @@ outputs:
tags:
- facts
- &set_overcloud_group_vars
hosts: DEPLOY_TARGET_HOST
- hosts: DEPLOY_TARGET_HOST
name: Set all_nodes data as group_vars for overcloud
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
any_errors_fatal: yes
@ -969,11 +951,50 @@ outputs:
DOCKER_PUPPET_PROCESS_COUNT: {get_param: DockerPuppetProcessCount}
DOCKER_PUPPET_MOUNT_HOST_PUPPET: {get_param: DockerPuppetMountHostPuppet}
template: |
- *gather_facts_undercloud
- *gather_facts_overcloud
- *load_global_variables
- *render_overcloud_group_vars
- *set_overcloud_group_vars
- hosts: DEPLOY_SOURCE_HOST
name: Gather facts from undercloud
gather_facts: yes
become: false
- hosts: DEPLOY_TARGET_HOST
name: Gather facts from overcloud
gather_facts: yes
- hosts: all
name: Load global variables
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
no_log: true
- 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
when: not ansible_check_mode|bool
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"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
{%- for role in roles %}
- hosts: {{role.name}}
name: Run update
@ -1216,11 +1237,58 @@ outputs:
BOOTSTRAP_SERVER_ID: {get_attr: [BootstrapServerId, value]}
ENABLE_DEBUG: {get_param: ConfigDebug}
template: |
- *gather_facts_undercloud
- *gather_facts_overcloud
- *load_global_variables
- *render_overcloud_group_vars
- *set_overcloud_group_vars
- hosts: DEPLOY_SOURCE_HOST:DEPLOY_TARGET_HOST
name: Gather facts from undercloud
gather_facts: no
become: false
tags: always
tasks:
- name: Force facts refresh before upgrade.
setup:
- hosts: all
name: Load global variables
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
no_log: true
- name: ensure we get the right selinux context
command: chcon -R -t svirt_sandbox_file_t /var/lib/config-data
args:
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
when: not ansible_check_mode|bool
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"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
{%- for step in range(0,upgrade_steps_max) %}
- hosts: DEPLOY_TARGET_HOST
name: Upgrade tasks for step {{step}}
@ -1302,11 +1370,59 @@ outputs:
CONTAINER_LOG_STDOUT_PATH: {get_param: ContainerLogStdoutPath}
CONTAINER_HEALTHCHECK_DISABLED: {get_param: ContainerHealthcheckDisabled}
template: |
- *gather_facts_undercloud
- *gather_facts_overcloud
- *load_global_variables
- *render_overcloud_group_vars
- *set_overcloud_group_vars
- hosts: DEPLOY_SOURCE_HOST
name: Gather facts from undercloud
gather_facts: yes
become: false
tags:
- always
- facts
# facts from overcloud may be needed for external installer inventory
- hosts: DEPLOY_TARGET_HOST
name: Gather facts from overcloud
gather_facts: yes
tags:
- always
- facts
- hosts: all
name: Load global variables
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
no_log: true
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
when: not ansible_check_mode|bool
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"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
{%- for step in range(external_upgrade_steps_max) %}
- hosts: DEPLOY_SOURCE_HOST
name: External upgrade step {{step}}
@ -1386,13 +1502,55 @@ outputs:
# Collect the facts from the overcloud nodes but ignore unreachable
# nodes in the case of a dead node which needs to be part of the
# scale-down operation.
- <<: *gather_facts_undercloud
- hosts: DEPLOY_SOURCE_HOST:DEPLOY_TARGET_HOST
name: Gather facts from overcloud
gather_facts: no
ignore_unreachable: True
- <<: *gather_facts_overcloud
ignore_unreachable: True
- *load_global_variables
- *render_overcloud_group_vars
- *set_overcloud_group_vars
tags:
- always
- facts
tasks:
- name: Force facts refresh before scale.
setup:
- hosts: all
name: Load global variables
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
tasks:
- include_vars: global_vars.yaml
no_log: true
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
when: not ansible_check_mode|bool
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"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
- hosts: DEPLOY_TARGET_HOST
name: Scaling
# NOTE(cloudnull): This is set to true explicitly so that we have up-to-date facts