Merge "Use a common playbook import for common plays" into stable/train
This commit is contained in:
commit
69c07ca809
|
@ -0,0 +1,66 @@
|
|||
- hosts: "{{ deploy_source_host }}"
|
||||
name: Gather facts from undercloud
|
||||
gather_facts: yes
|
||||
any_errors_fatal: yes
|
||||
ignore_unreachable: "{{ ignore_unreachable | default(false) }}"
|
||||
become: false
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- hosts: "{{ deploy_target_host }}"
|
||||
name: Gather facts from overcloud
|
||||
gather_facts: yes
|
||||
any_errors_fatal: yes
|
||||
ignore_unreachable: "{{ ignore_unreachable | default(false) }}"
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- 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
|
||||
|
||||
- hosts: "{{ deploy_target_host }}"
|
||||
name: Render all_nodes data as group_vars for overcloud
|
||||
gather_facts: "{{ gather_facts | default(false) }}"
|
||||
any_errors_fatal: yes
|
||||
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
|
||||
tripleo_all_nodes_data:
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- hosts: "{{ deploy_target_host }}"
|
||||
name: Set all_nodes data as group_vars for overcloud
|
||||
gather_facts: "{{ gather_facts | default(false) }}"
|
||||
any_errors_fatal: yes
|
||||
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
|
|
@ -394,6 +394,7 @@ outputs:
|
|||
extra_hosts_entries: {get_param: ExtraHostsEntries}
|
||||
vip_hosts_entries: {get_param: VipHostsEntries}
|
||||
keystone_resources: {get_param: KeystoneResourcesConfigs}
|
||||
common_deploy_steps_playbooks: {get_file: deploy-steps-playbooks-common.yaml}
|
||||
common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
|
||||
hiera_steps_tasks: {get_file: hiera-steps-tasks.yaml}
|
||||
deploy_steps_tasks_step_0: {get_file: deploy-steps-tasks-step-0.yaml}
|
||||
|
@ -426,56 +427,10 @@ outputs:
|
|||
SELINUX_MODE: {get_param: SELinuxMode}
|
||||
{% endblock %}
|
||||
template: |
|
||||
- hosts: DEPLOY_SOURCE_HOST
|
||||
name: Gather facts from undercloud
|
||||
gather_facts: yes
|
||||
any_errors_fatal: yes
|
||||
become: false
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- hosts: DEPLOY_TARGET_HOST
|
||||
name: Gather facts from overcloud
|
||||
gather_facts: yes
|
||||
any_errors_fatal: yes
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- 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
|
||||
tags:
|
||||
- always
|
||||
|
||||
- hosts: DEPLOY_TARGET_HOST
|
||||
name: Render all_nodes data as group_vars for overcloud
|
||||
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
|
||||
any_errors_fatal: yes
|
||||
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
|
||||
tripleo_all_nodes_data:
|
||||
tags:
|
||||
- facts
|
||||
|
||||
- hosts: DEPLOY_TARGET_HOST
|
||||
name: Set all_nodes data as group_vars for overcloud
|
||||
gather_facts: {{ '"{{' }} gather_facts | default(false) {{ '}}"' }}
|
||||
any_errors_fatal: yes
|
||||
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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
|
||||
- hosts: all
|
||||
name: Manage SELinux
|
||||
|
@ -903,50 +858,10 @@ outputs:
|
|||
update_steps_playbook:
|
||||
{{ self.deploy_steps_str_replace_params() }}
|
||||
template: |
|
||||
- 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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
{%- for role in roles %}
|
||||
- hosts: {{role.name}}
|
||||
name: Run update
|
||||
|
@ -998,50 +913,10 @@ outputs:
|
|||
external_update_steps_playbook:
|
||||
{{ self.deploy_steps_str_replace_params() }}
|
||||
template: |
|
||||
- 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
|
||||
tripleo_all_nodes_data:
|
||||
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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
{%- for step in range(external_update_steps_max) %}
|
||||
- hosts: DEPLOY_SOURCE_HOST
|
||||
name: External update step {{step}}
|
||||
|
@ -1106,41 +981,10 @@ outputs:
|
|||
{{ self.deploy_steps_str_replace_params() }}
|
||||
template: |
|
||||
{%- for role in roles %}
|
||||
- hosts: {{role.name}}
|
||||
name: Gather facts from undercloud
|
||||
gather_facts: yes
|
||||
become: false
|
||||
- hosts: {{role.name}}
|
||||
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
|
||||
tripleo_all_nodes_data:
|
||||
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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST:{{role.name}}"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
- hosts: {{role.name}}
|
||||
name: Run pre-upgrade rolling tasks
|
||||
serial: {{ role.deploy_serial | default(1) }}
|
||||
|
@ -1155,64 +999,10 @@ outputs:
|
|||
upgrade_steps_playbook:
|
||||
{{ self.deploy_steps_str_replace_params() }}
|
||||
template: |
|
||||
- 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: make sure /var/lib/config-data exists
|
||||
file:
|
||||
path: /var/lib/config-data
|
||||
state: directory
|
||||
setype: svirt_sandbox_file_t
|
||||
selevel: s0
|
||||
- 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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
{%- for step in range(0,upgrade_steps_max) %}
|
||||
- hosts: DEPLOY_TARGET_HOST
|
||||
name: Upgrade tasks for step {{step}}
|
||||
|
@ -1270,59 +1060,10 @@ outputs:
|
|||
external_upgrade_steps_playbook:
|
||||
{{ self.deploy_steps_str_replace_params() }}
|
||||
template: |
|
||||
- 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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
{%- for step in range(external_upgrade_steps_max) %}
|
||||
- hosts: DEPLOY_SOURCE_HOST
|
||||
name: External upgrade step {{step}}
|
||||
|
@ -1389,55 +1130,12 @@ 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.
|
||||
- hosts: DEPLOY_SOURCE_HOST:DEPLOY_TARGET_HOST
|
||||
name: Gather facts from overcloud
|
||||
gather_facts: no
|
||||
ignore_unreachable: True
|
||||
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
|
||||
- import_playbook: common_deploy_steps_playbooks.yaml
|
||||
vars:
|
||||
deploy_source_host: "DEPLOY_SOURCE_HOST"
|
||||
deploy_target_host: "DEPLOY_TARGET_HOST"
|
||||
ignore_unreachable: true
|
||||
|
||||
- hosts: DEPLOY_TARGET_HOST
|
||||
name: Scaling
|
||||
# NOTE(cloudnull): This is set to true explicitly so that we have up-to-date facts
|
||||
|
|
Loading…
Reference in New Issue