From feef2cb04e08345db05b3a6018db94e2234c0616 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Wed, 13 Jul 2022 15:44:59 +0200 Subject: [PATCH] FFWD3 Refactor ffwd upgrade for train to wallaby This is first attempt to test whole upgrade procedure from Train to Wallaby. We for now deal just with the OpenStack upgrade part without OS upgrade step. When we will understand the process better we will refactor this code. Changes: - Remove tls templates comversion. - Cleanup adjust-roles-data. We might introduce new ones. - Handle the network switch to ansible templates - For now use Fast Furious procedure to generate playbook - Add ceph adoption workflow from ceph-ansible to cephadm Co-authored-by: jbadiapa@redhat.com Change-Id: Iae1c9ef1244676589ee505201093daa52704a438 --- tasks/common/adjust-roles-data.yaml | 131 ------------------ tasks/common/auxilary-facts.yaml | 5 + .../convert_tls_templates.yaml | 20 --- .../create-overcloud-ffu-scripts.yaml | 24 +++- tasks/fast-forward-upgrade/main.yml | 4 - .../overcloud_upgrade_fast_and_furious.yaml | 2 +- templates/ceph-upgrade-run.sh.j2 | 37 ++++- templates/ceph_host_limit.txt.j2 | 3 + 8 files changed, 66 insertions(+), 160 deletions(-) delete mode 100644 tasks/fast-forward-upgrade/convert_tls_templates.yaml create mode 100644 templates/ceph_host_limit.txt.j2 diff --git a/tasks/common/adjust-roles-data.yaml b/tasks/common/adjust-roles-data.yaml index c27ebc80..eaad0fc2 100644 --- a/tasks/common/adjust-roles-data.yaml +++ b/tasks/common/adjust-roles-data.yaml @@ -1,135 +1,4 @@ --- -- name: add OsloMessagingRpc and OsloMessagingNotify services - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::RabbitMQ$)' - replace: '\1\2\1- {{ item }}' - loop: - - "OS::TripleO::Services::OsloMessagingRpc" - - "OS::TripleO::Services::OsloMessagingNotify" - -- name: drop RabbiMQ service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::RabbitMQ$)' - replace: '' - -- name: Replace Docker for Podman service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::Docker$)' - replace: '\1- OS::TripleO::Services::Podman' - -- name: Replace NovaPlacement for PlacementApi service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::NovaPlacement$)' - replace: '\1- OS::TripleO::Services::PlacementApi' - -- name: drop Congress service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::Congress$)' - replace: '' - -- name: Replace Fluentd for Rsyslog service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::Fluentd$)' - replace: '\1- OS::TripleO::Services::Rsyslog' - -- name: Replace SensuClient for Collectd service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::SensuClient$)' - replace: '\1- OS::TripleO::Services::Collectd' - - -- name: add ContainerImagePrepare service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::HAproxy$)' - replace: '\1\2\1- OS::TripleO::Services::ContainerImagePrepare' - -- name: add BootParams service - replace: - path: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::AuditD$)' - replace: '\1\2\1- OS::TripleO::Services::BootParams' - -- name: drop deprecated telemetry services - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::{{ item }}$)' - replace: '' - loop: - - CeilometerApi - - CeilometerCollector - - CeilometerExpirer - -- name: drop MongDB service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::MongoDb$)' - replace: '' - -- name: drop GlanceRegistry service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::GlanceRegistry$)' - replace: '' - -- name: drop NovaConsoleAuth service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::NovaConsoleauth$)' - replace: '' - -- name: drop OpenDaylight services - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::{{ item }}$)' - replace: '' - loop: - - OpenDaylightOvs - - OpenDaylightApi - -- name: drop NeutronLBaas services - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::{{ item }}$)' - replace: '' - loop: - - NeutronLbaasv2Agent - - NeutronLbaasv2Api - -- name: drop Tacker service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::Tacker$)' - replace: '' - -- name: drop Panko service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::PankoApi$)' - replace: '' - -- name: drop Ntp service - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::Ntp$)' - replace: '' - -- name: drop Skydive services - replace: - dest: "{{ roles_data }}" - regexp: '(\s+)(- OS::TripleO::Services::{{ item }}$)' - replace: '' - loop: - - SkydiveAgent - - SkydiveAnalyzer - # By default we have update_serial either unset at all for OSP13 and OSP14 or # we have it set where Pacemaker enabled nodes, CephOSD nodes and Networkers # have it set to 1. This is mostly defensive precaution and we do allow running diff --git a/tasks/common/auxilary-facts.yaml b/tasks/common/auxilary-facts.yaml index 9a0efe60..a54e10b4 100644 --- a/tasks/common/auxilary-facts.yaml +++ b/tasks/common/auxilary-facts.yaml @@ -98,6 +98,11 @@ set_fact: initial_env_file: "{{ initial_env_file }}" +- name: get network environment fact for FFWD3 + set_fact: + network_environment_file: "{{initial_env_file.stdout_lines | select('search','network-environment')| first}}" + when: initial_env_file.stdout_lines | select('search','network-environment') | list | count > 0 + - name: fetch roles-data file referenced in initial deploy script shell: | awk '/-r\s|--roles-file\s/ {gsub(/[[:space:]]/, "", $2); print $2}' {{ overcloud_deploy_script }} diff --git a/tasks/fast-forward-upgrade/convert_tls_templates.yaml b/tasks/fast-forward-upgrade/convert_tls_templates.yaml deleted file mode 100644 index 6d08e4c9..00000000 --- a/tasks/fast-forward-upgrade/convert_tls_templates.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: look for OS::TripleO::NodeTLSData config - shell: | - grep "OS::TripleO::NodeTLSData" {{ item }} - ignore_errors: true - register: tls_config_envs - loop: "{{ initial_env_file.stdout_lines }}" - -- name: set tls_node_data fact - set_fact: - tls_node_data: "{{ item.item }}" - when: item.stdout|length > 0 - loop: "{{ tls_config_envs.results }}" - -- name: Remove NodeTLSData service - replace: - path: "{{ tls_node_data }}" - regexp: '(\s+)(OS::TripleO::NodeTLSData).*' - replace: '\1OS::TripleO::NodeTLSData: OS::Heat::None' - when: tls_node_data is defined diff --git a/tasks/fast-forward-upgrade/create-overcloud-ffu-scripts.yaml b/tasks/fast-forward-upgrade/create-overcloud-ffu-scripts.yaml index 17aa581c..77be5be7 100644 --- a/tasks/fast-forward-upgrade/create-overcloud-ffu-scripts.yaml +++ b/tasks/fast-forward-upgrade/create-overcloud-ffu-scripts.yaml @@ -119,7 +119,7 @@ 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) }}" + 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 @@ -127,7 +127,10 @@ - name: create overcloud upgrade prepare script vars: - old_img: "{{ working_dir }}/{{ container_registry_file }}" + 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 }}" @@ -136,13 +139,28 @@ - name: create overcloud converge script vars: - old_img: "{{ working_dir }}/{{ container_registry_file }}" + 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" diff --git a/tasks/fast-forward-upgrade/main.yml b/tasks/fast-forward-upgrade/main.yml index e3d7f933..1d4fffe5 100644 --- a/tasks/fast-forward-upgrade/main.yml +++ b/tasks/fast-forward-upgrade/main.yml @@ -152,10 +152,6 @@ - overcloud_upgrade_prepare - upgrades_validations - - name: convert tls templates - import_tasks: convert_tls_templates.yaml - tags: ffu_overcloud_prepare - - name: replace environment files import_tasks: ../common/replace_environment_files.yaml tags: ffu_overcloud_prepare diff --git a/tasks/fast-forward-upgrade/overcloud_upgrade_fast_and_furious.yaml b/tasks/fast-forward-upgrade/overcloud_upgrade_fast_and_furious.yaml index 5e1c2db5..0bb1ca97 100644 --- a/tasks/fast-forward-upgrade/overcloud_upgrade_fast_and_furious.yaml +++ b/tasks/fast-forward-upgrade/overcloud_upgrade_fast_and_furious.yaml @@ -18,4 +18,4 @@ {{ (oc_roles_hosts|dict2items | default([])) | map(attribute='value') | map('sort') | flatten(1) }} include_tasks: overcloud_upgrade_hosts.yaml - with_together: "{{ (oc_role_host_list | length == 0) | ternary([[], []], oc_role_host_list) }}" + with_together: "{{ (oc_role_host_list | length == 0) | ternary([[], []], oc_role_host_list) + ['undercloud'] }}" diff --git a/templates/ceph-upgrade-run.sh.j2 b/templates/ceph-upgrade-run.sh.j2 index 26ff062d..104d92a8 100644 --- a/templates/ceph-upgrade-run.sh.j2 +++ b/templates/ceph-upgrade-run.sh.j2 @@ -37,9 +37,44 @@ openstack overcloud external-upgrade run ${EXTERNAL_ANSWER} \ {% if ceph_upgrade_skip_tags|default(false) -%} --skip-tags "{{ ceph_upgrade_skip_tags }}" \ {% endif -%} - --tags ceph 2>&1 + --tags ceph,facts 2>&1 echo "[$(date)] Major upgrade - finished Ceph upgrade step" + +## Install cephadm on the servers + +echo "[$(date)] Major upgrade - cephadm-admin user and distribute keyrings step" + +ANSIBLE_LOG_PATH=/home/stack/cephadm_enable_user_key.log \ +ANSIBLE_HOST_KEY_CHECKING=false \ +ansible-playbook -i /home/stack/overcloud-deploy/{{ overcloud_stack_name }}/config-download/{{ overcloud_stack_name }}/tripleo-ansible-inventory.yaml \ + -b -e ansible_python_interpreter=/usr/libexec/platform-python /usr/share/ansible/tripleo-playbooks/ceph-admin-user-playbook.yml \ + -e tripleo_admin_user=ceph-admin \ + -e distribute_private_key=true \ + --limit @/home/stack/ceph_host_limit.txt + +echo "[$(date)] Major upgrade - finished cephadm-admin user and distribute keyrings step" + +echo "[$(date)] Major upgrade - upgrade run setup_packages" + +openstack overcloud upgrade run ${EXTERNAL_ANSWER} \ + --stack {{ overcloud_stack_name }} \ + --tags setup_packages --limit @/home/stack/ceph_host_limit.txt --playbook /home/stack/overcloud-deploy/{{ overcloud_stack_name }}/config-download/{{ overcloud_stack_name }}/upgrade_steps_playbook.yaml 2>&1 + +echo "[$(date)] Major upgrade - upgrade run setup_packages" + +echo "[$(date)] Major upgrade - Cephadm adoption" + +openstack overcloud external-upgrade run ${EXTERNAL_ANSWER} \ + --stack {{ overcloud_stack_name }} \ + {% if ceph_upgrade_skip_tags|default(false) -%} + --skip-tags "{{ ceph_upgrade_skip_tags }}" \ + {% endif -%} + --tags cephadm_adopt 2>&1 + +echo "[$(date)] Major upgrade - finished Cephadm adoption step" + + {% if l3_agent_connectivity_check|bool %} if [[ -e {{ working_dir }}/l3_agent_stop_ping.sh ]]; then source {{ overcloud_rc }} diff --git a/templates/ceph_host_limit.txt.j2 b/templates/ceph_host_limit.txt.j2 new file mode 100644 index 00000000..3dab10da --- /dev/null +++ b/templates/ceph_host_limit.txt.j2 @@ -0,0 +1,3 @@ +{% for role in ceph_limit_roles -%} +{{ role }} +{% endfor -%}