tripleo-upgrade/tasks/fast-forward-upgrade/create-overcloud-ffu-script...

187 lines
6.7 KiB
YAML

---
- name: create a compatible deployment scripts from oooq
include_tasks: ../upgrade/use_oooq.yaml
args:
apply:
tags: use_oooq
tags: use_oooq
when: use_oooq|bool
- name: make a copy of the initial overcloud deploy script
copy:
remote_src: true
src: "{{ overcloud_deploy_script }}"
dest: "{{ overcloud_deploy_script }}.orig.sh"
- name: Convert CLI options to parameters
import_tasks: ../common/convert_cli_opts_params.yaml
- name: get auxiliary facts for upgrade
import_tasks: ../common/auxilary-facts.yaml
- name: generate roles list from inventory file
import_tasks: ../common/load_roles_from_inventory.yaml
- name: create ffu upgrade workaround scripts
template:
src: workarounds.sh.j2
dest: "{{ working_dir }}/{{ item }}.sh"
mode: 0775
force: true
loop:
- 'pre_ffu_overcloud_upgrade_prepare_workarounds'
- 'post_ffu_overcloud_upgrade_prepare_workarounds'
- 'pre_ffu_overcloud_os_upgrade_workarounds'
- 'post_ffu_overcloud_os_upgrade_workarounds'
- 'pre_ffu_overcloud_upgrade_workarounds'
- 'post_ffu_overcloud_upgrade_workarounds'
- 'pre_ffu_overcloud_converge_workarounds'
- 'post_ffu_overcloud_converge_workarounds'
- 'pre_ffu_overcloud_ceph_workarounds'
- 'post_ffu_overcloud_ceph_workarounds'
when: ffu_upgrade_workarounds
- name: create the custom upgrade init commands
template:
src: "upgrade_init_command.yaml.j2"
dest: "{{ upgrade_init_command_dest }}"
mode: 0775
when: upgrade_init_command is string
- name: create overcloud_prepare_containers.sh script
template:
src: overcloud_prepare_containers.sh.j2
dest: "{{ working_dir }}/overcloud_prepare_containers.sh"
mode: 0755
force: true
- set_fact:
pcs_upgrade_hosts: ""
- name: Upgrade without outage
when: not fast_and_furious|bool
block:
# The below filter chain does the following:
# - Get the list of roles NOT present in the nova_compute groups
# - Get the list of hosts in each role into an array
# - Sort the resulting list of hosts for each role
# - Return a list of host lists. eg: [['ctrl-1', 'ctrl2', 'ctrl-3'], ['DB1']]
# - OR if the role does not exist, it returns []
- set_fact:
oc_role_host_list_controlplane: >-
{{ (oc_roles_hosts|dict2items |
rejectattr('key', 'in', inventory_rolemap['nova_compute'] | default([]))) |
map(attribute='value') | map('sort') | list }}
# - Then with_together does a zip_longest to combine the list of lists,
# using None to fill the gaps.
# - We take care of the possible [] value by replacing it with two empty lists.
- name: create controlplane based overcloud system upgrade script for {{ item }}
vars:
pcs_present: true
compute_present: false
include_tasks: create-overcloud-ffu-hosts-scripts.yaml
with_together: "{{ (oc_role_host_list_controlplane | length == 0) | ternary([[], []], oc_role_host_list_controlplane) }}"
- set_fact:
pcs_upgrade_hosts: ""
# The below filter chain does the following:
# - Get the list of roles present in the nova_compute group
# - Get the list of hosts in each role into an array
# - Sort the resulting list of hosts for each role
# - Return a list of host lists
# - OR if the role does not exist, it returns []
- set_fact:
oc_role_host_list_nova_compute: >-
{{ (oc_roles_hosts|dict2items |
selectattr('key', 'in', inventory_rolemap['nova_compute'] | default([]))) |
map(attribute='value') | map('sort') | list }}
# - Then with_together does a zip_longest to combine the list of lists,
# using None to fill the gaps.
# - We take care of the possible [] value by replacing it with two empty lists.
- name: create compute based overcloud system upgrade script for {{ item }}
vars:
pcs_present: false
compute_present: true
include_tasks: create-overcloud-ffu-hosts-scripts.yaml
with_together: "{{ (oc_role_host_list_nova_compute | length == 0) | ternary([[], []], oc_role_host_list_nova_compute) }}"
- name: Upgrade with outage
when: fast_and_furious|bool
block:
# - Then with_together does a zip_longest to combine the list of lists,
# using None to fill the gaps.
# - We take care of the possible [] value by replacing it with two empty lists.
- name: create whole overcloud system upgrade script
vars:
pcs_present: false
compute_present: false
include_tasks: create-overcloud-ffu-hosts-scripts.yaml
with_together: "{{ (oc_roles_hosts|dict2items | default([])) | map(attribute='value') | map('sort') | flatten(1) + ['undercloud'] }}"
- name: build extra templates based on new options.
import_tasks: ../common/build_extra_template.yaml
when: config_heat_extra_yaml is defined
- name: create overcloud upgrade prepare script
vars:
old_img:
- "{{ working_dir }}/{{ container_registry_file }}"
- "/usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml"
- "{{ network_environment_file | default('') }}"
template:
src: "overcloud_upgrade_prepare.sh.j2"
dest: "{{ overcloud_upgrade_prepare_script }}"
mode: 0775
force: true
- name: create overcloud converge script
vars:
old_img:
- "{{ working_dir }}/{{ container_registry_file }}"
- "/usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml"
- "{{ network_environment_file | default('') }}"
template:
src: "overcloud_upgrade_converge.sh.j2"
dest: "{{ working_dir }}/overcloud_upgrade_converge.sh"
mode: 0775
force: true
- name: create ceph_host_limit file
vars:
# roles where the cephadm-admin and keyring is shared
ceph_limit_roles:
- Undercloud
- ceph_osd
- ceph_mon
template:
src: "ceph_host_limit.txt.j2"
dest: "{{ working_dir }}/ceph_host_limit.txt"
mode: 0764
- name: create ceph upgrade script
template:
src: "ceph-upgrade-run.sh.j2"
dest: "{{ working_dir }}/ceph-upgrade-run.sh"
mode: 0755
- name: import ssh_config_skip_host tasks
import_tasks: ../common/ssh_config_skip_host.yml
- name: Create post upgrade scripts for controller nodes
import_tasks: ../common/controller_post_scripts.yml
- name: import create_l3_agent_connectivity_check_script tasks
import_tasks: ../common/create_l3_agent_connectivity_check_script.yml
- name: import create_l3_agent_failover_check_script tasks
import_tasks: ../common/create_l3_agent_failover_check_script.yml
- name: create nova actions check script
import_tasks: ../common/create_nova_actions_check_script.yml
- name: import create HTTP test scripts
import_tasks: ../common/create_http_test_scripts.yml