From 81db32ca8c426724efa6bbd43e2ba2b4910072a9 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 23 Mar 2018 14:47:34 +0100 Subject: [PATCH] Upgrades: Refactor httpd_enabled variable To not to redefine variable multiple times in each service we split httpd_enabled to per service fact set in step|int == 0 block. Change-Id: Icea0865aadd9253ead464247bf78f45842b3a578 --- docker/services/aodh-api.yaml | 70 ++++++++++-------- docker/services/gnocchi-api.yaml | 87 ++++++++++++---------- docker/services/heat-api-cfn.yaml | 84 +++++++++++---------- docker/services/heat-api.yaml | 93 ++++++++++++----------- docker/services/horizon.yaml | 25 ++++--- docker/services/ironic-api.yaml | 87 ++++++++++++---------- docker/services/keystone.yaml | 60 ++++++++------- docker/services/mistral-api.yaml | 85 +++++++++++---------- docker/services/nova-api.yaml | 111 ++++++++++++++-------------- docker/services/nova-placement.yaml | 68 +++++++++-------- docker/services/octavia-api.yaml | 85 +++++++++++---------- docker/services/tripleo-ui.yaml | 60 ++++++++------- docker/services/zaqar.yaml | 42 ++++++----- puppet/services/apache.j2.yaml | 32 ++++---- 14 files changed, 529 insertions(+), 460 deletions(-) diff --git a/docker/services/aodh-api.yaml b/docker/services/aodh-api.yaml index 10ddb19048..1e084b4346 100644 --- a/docker/services/aodh-api.yaml +++ b/docker/services/aodh-api.yaml @@ -169,39 +169,45 @@ outputs: /var/log/containers/aodh and /var/log/containers/httpd/aodh-api. ignore_errors: true upgrade_tasks: - - name: Check for aodh api service running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q aodh" - ignore_errors: True - register: httpd_enabled - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if aodh api is running" - shell: systemctl status 'httpd' | grep -q aodh - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop and disable aodh service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no - - name: Set fact for removal of openstack-aodh-api package - when: step|int == 2 - set_fact: - remove_aodh_api_package: {get_param: UpgradeRemoveUnusedPackages} - - name: Remove openstack-aodh-api package if operator requests it - yum: name=openstack-aodh-api state=removed - ignore_errors: True - when: - - step|int == 2 - - remove_aodh_api_package|bool + block: + - name: Check for aodh api service running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q aodh" + ignore_errors: True + register: aodh_httpd_enabled_result + - name: Set fact aodh_httpd_enabled + set_fact: + aodh_httpd_enabled: "{{ aodh_httpd_enabled_result.rc == 0 }}" + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - name: Set fact httpd_running + set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if aodh api is running" + shell: systemctl status 'httpd' | grep -q aodh + tags: validation + when: + - aodh_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable aodh service (running under httpd) + when: + - aodh_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no + - name: Set fact for removal of openstack-aodh-api package + set_fact: + remove_aodh_api_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-aodh-api package if operator requests it + yum: name=openstack-aodh-api state=removed + ignore_errors: True + when: remove_aodh_api_package|bool metadata_settings: get_attr: [AodhApiPuppetBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/gnocchi-api.yaml b/docker/services/gnocchi-api.yaml index 157800c4e1..c576ac0e4a 100644 --- a/docker/services/gnocchi-api.yaml +++ b/docker/services/gnocchi-api.yaml @@ -222,47 +222,54 @@ outputs: path: /etc/ceph state: directory upgrade_tasks: - - name: Check if gnocchi_api is deployed - command: systemctl is-enabled --quiet openstack-gnocchi-api + - when: step|int == 0 tags: common - ignore_errors: True - register: gnocchi_api_enabled - - name: Check for gnocchi_api running under apache - tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q gnocchi" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-gnocchi-api is running" - command: systemctl is-active --quiet openstack-gnocchi-api - when: - - step|int == 0 - - gnocchi_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - tags: validation - - name: Stop and disable gnocchi_api service - service: name=openstack-gnocchi-api state=stopped enabled=no - when: - - step|int == 2 - - gnocchi_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if gnocchi_api_wsgi is running" - shell: systemctl status 'httpd' | grep -q gnocchi - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop and disable httpd service - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no + block: + - name: Check if gnocchi_api is deployed + command: systemctl is-enabled --quiet openstack-gnocchi-api + ignore_errors: True + register: gnocchi_api_enabled_result + - name: Set fact gnocchi_api_enabled + set_fact: + gnocchi_api_enabled: "{{ gnocchi_api_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-gnocchi-api is running" + command: systemctl is-active --quiet openstack-gnocchi-api + when: + - gnocchi_api_enabled|bool + tags: validation + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - name: Set fact httpd_running + set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: Check for gnocchi_api running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q gnocchi" + ignore_errors: True + register: gnocchi_httpd_enabled_result + - name: set fact gnocchi_httpd_enabled + set_fact: + gnocchi_httpd_enabled: "{{ gnocchi_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check if gnocchi_api_wsgi is running" + shell: systemctl status 'httpd' | grep -q gnocchi + tags: validation + when: + - gnocchi_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable gnocchi_api service + service: name=openstack-gnocchi-api state=stopped enabled=no + when: + - gnocchi_api_enabled|bool + - name: Stop and disable httpd service + when: + - gnocchi_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no metadata_settings: get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/heat-api-cfn.yaml b/docker/services/heat-api-cfn.yaml index cfb690d93b..ddf1477a4d 100644 --- a/docker/services/heat-api-cfn.yaml +++ b/docker/services/heat-api-cfn.yaml @@ -142,47 +142,51 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]} upgrade_tasks: - - name: Check if heat_api_cfn is deployed - command: systemctl is-enabled --quiet openstack-heat-api-cfn + - when: step|int == 0 tags: common - ignore_errors: True - register: heat_api_cfn_enabled - - name: Check for heat_api_cfn running under apache - tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running" - command: systemctl is-active --quiet openstack-heat-api-cfn - when: - - step|int == 0 - - heat_api_cfn_enabled.rc == 0 - - httpd_enabled.rc != 0 - tags: validation - - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd) - service: name=openstack-heat-api-cfn state=stopped enabled=no - when: - - step|int == 2 - - heat_api_cfn_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running" - tags: validation - shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop heat_api_cfn service (running under httpd) - service: name=httpd state=stopped - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 + block: + - name: Check if heat_api_cfn is deployed + command: systemctl is-enabled --quiet openstack-heat-api-cfn + ignore_errors: True + register: heat_api_cfn_enabled_result + - set_fact: + heat_api_cfn_enabled: heat_api_cfn_enabled_result|bool + - name: Check for heat_api_cfn running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi" + ignore_errors: True + register: heat_api_cfn_httpd_enabled_result + - set_fact: + heat_api_cfn_httpd_enabled: "{{ heat_api_cfn_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running" + command: systemctl is-active --quiet openstack-heat-api-cfn + when: + - heat_api_cfn_enabled|bool + tags: validation + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running" + tags: validation + shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi + when: + - heat_api_cfn_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd) + service: name=openstack-heat-api-cfn state=stopped enabled=no + when: + - heat_api_cfn_enabled|bool + - name: Stop heat_api_cfn service (running under httpd) + service: name=httpd state=stopped enabled=no + when: + - heat_api_cfn_httpd_enabled|bool + - httpd_running|bool metadata_settings: get_attr: [HeatBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/heat-api.yaml b/docker/services/heat-api.yaml index 33a48d2682..4794c18bbc 100644 --- a/docker/services/heat-api.yaml +++ b/docker/services/heat-api.yaml @@ -180,52 +180,55 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]} upgrade_tasks: - - name: Check if heat_api is deployed - command: systemctl is-enabled --quiet openstack-heat-api + - when: step|int == 0 tags: common - ignore_errors: True - register: heat_api_enabled - - name: Check for heat_api running under apache - tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-heat-api is running" - command: systemctl is-active --quiet openstack-heat-api - when: - - step|int == 0 - - heat_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - tags: validation - - name: Stop and disable heat_api service (pre-upgrade not under httpd) - service: name=openstack-heat-api state=stopped enabled=no - when: - - step|int == 2 - - heat_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running" - shell: systemctl status 'httpd' | grep -q heat_api_wsgi - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop heat_api service (running under httpd) - service: name=httpd state=stopped - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: remove old heat cron jobs - when: step|int == 2 - file: - path: /var/spool/cron/heat - state: absent + block: + - name: Check if heat_api is deployed + command: systemctl is-enabled --quiet openstack-heat-api + ignore_errors: True + register: heat_api_enabled_result + - set_fact: + heat_api_enabled: "{{ heat_api_enabled_result.rc == 0 }}" + - name: Check for heat_api running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi" + ignore_errors: True + register: heat_api_httpd_enabled_result + - set_fact: + heat_api_httpd_enabled: "{{ heat_api_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-heat-api is running" + command: systemctl is-active --quiet openstack-heat-api + when: + - heat_api_enabled|bool + tags: validation + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running" + shell: systemctl status 'httpd' | grep -q heat_api_wsgi + tags: validation + when: + - heat_api_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable heat_api service (pre-upgrade not under httpd) + service: name=openstack-heat-api state=stopped enabled=no + when: + - heat_api_enabled|bool + - name: Stop heat_api service (running under httpd) + service: name=httpd state=stopped + when: + - heat_api_httpd_enabled|bool + - httpd_running|bool + - name: remove old heat cron jobs + file: + path: /var/spool/cron/heat + state: absent metadata_settings: get_attr: [HeatBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/horizon.yaml b/docker/services/horizon.yaml index 91ca73896c..6e3d8269b7 100644 --- a/docker/services/horizon.yaml +++ b/docker/services/horizon.yaml @@ -187,21 +187,24 @@ outputs: /var/log/containers/horizon and /var/log/containers/httpd/horizon. ignore_errors: true upgrade_tasks: - - name: Check for horizon running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q horizon_vhost" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check if horizon is running" - shell: systemctl is-active --quiet httpd - when: - - step|int == 0 - - httpd_enabled.rc == 0 - tags: validation + block: + - name: Check for horizon running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q horizon_vhost" + ignore_errors: True + register: horizon_httpd_enabled_result + - set_fact: + horizon_httpd_enabled: "{{ horizon_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check if horizon is running" + shell: systemctl is-active --quiet httpd + when: + - horizon_httpd_enabled|bool + tags: validation - name: Stop and disable horizon service (running under httpd) when: - step|int == 2 - - httpd_enabled.rc == 0 + - horizon_httpd_enabled|bool service: name=httpd state=stopped enabled=no metadata_settings: get_attr: [HorizonBase, role_data, metadata_settings] diff --git a/docker/services/ironic-api.yaml b/docker/services/ironic-api.yaml index e3280fde5f..a19b81130e 100644 --- a/docker/services/ironic-api.yaml +++ b/docker/services/ironic-api.yaml @@ -151,47 +151,54 @@ outputs: /var/log/containers/ironic and /var/log/containers/httpd/ironic-*. ignore_errors: true upgrade_tasks: - - name: Check if ironic_api is deployed - command: systemctl is-enabled --quiet openstack-ironic-api + - when: step|int == 0 tags: common - ignore_errors: True - register: ironic_api_enabled - - name: Check for ironic_api running under apache - tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q ironic" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-ironic-api is running" - command: systemctl is-active --quiet openstack-ironic-api - when: - - step|int == 0 - - ironic_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - tags: validation - - name: Stop and disable ironic_api service - when: - - step|int == 2 - - ironic_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - service: name=openstack-ironic-api state=stopped enabled=no - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if ironic_api_wsgi is running" - shell: systemctl status 'httpd' | grep -q ironic - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop ironic_api service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no + block: + - name: Check if ironic_api is deployed + command: systemctl is-enabled --quiet openstack-ironic-api + ignore_errors: True + register: ironic_api_enabled_result + - name: Set fact ironic_api_enabled + set_fact: + ironic_api_enabled: "{{ ironic_api_enabled_result.rc == 0 }}" + - name: Check for ironic_api running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q ironic" + ignore_errors: True + register: ironic_httpd_enabled_result + - name: Set fact ironic_httpd_enabled + set_fact: + ironic_httpd_enabled: "{{ ironic_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-ironic-api is running" + command: systemctl is-active --quiet openstack-ironic-api + when: + - ironic_api_enabled|bool + tags: validation + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - name: Set fact httpd_running + set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if ironic_api_wsgi is running" + shell: systemctl status 'httpd' | grep -q ironic + tags: validation + when: + - ironic_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable ironic_api service + when: + - ironic_api_enabled|bool + service: name=openstack-ironic-api state=stopped enabled=no + - name: Stop ironic_api service (running under httpd) + when: + - ironic_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no fast_forward_upgrade_tasks: - block: - name: Check if ironic_api is deployed diff --git a/docker/services/keystone.yaml b/docker/services/keystone.yaml index 479eb69547..02c705eeb5 100644 --- a/docker/services/keystone.yaml +++ b/docker/services/keystone.yaml @@ -221,34 +221,40 @@ outputs: config_image: *keystone_config_image host_prep_tasks: {get_attr: [KeystoneLogging, host_prep_tasks]} upgrade_tasks: - - name: Check for keystone running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q keystone_wsgi" - ignore_errors: True - register: httpd_enabled - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if keystone_wsgi is running under httpd" - shell: systemctl status 'httpd' | grep -q keystone - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop and disable keystone service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no - - name: remove old keystone cron jobs - when: step|int == 2 - file: - path: /var/spool/cron/keystone - state: absent + block: + - name: Check for keystone running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q keystone_wsgi" + ignore_errors: True + register: keystone_httpd_enabled_result + - set_fact: + keystone_httpd_enabled: "{{ keystone_httpd_enabled_result.rc == 0 }}" + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if keystone_wsgi is running under httpd" + shell: systemctl status 'httpd' | grep -q keystone + tags: validation + when: + - keystone_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable keystone service (running under httpd) + when: + - keystone_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no + - name: remove old keystone cron jobs + file: + path: /var/spool/cron/keystone + state: absent metadata_settings: get_attr: [KeystoneBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/mistral-api.yaml b/docker/services/mistral-api.yaml index 0b14bd3afa..730b2b6ff3 100644 --- a/docker/services/mistral-api.yaml +++ b/docker/services/mistral-api.yaml @@ -161,44 +161,49 @@ outputs: /var/log/containers/mistral. ignore_errors: true upgrade_tasks: - - name: Check if mistral api is deployed - command: systemctl is-enabled --quiet openstack-mistral-api + - when: step|int == 0 tags: common - ignore_errors: True - register: mistral_api_enabled - - name: Check for mistral_api running under apache - tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q mistral" - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check if openstack-mistral-api is running" - command: systemctl is-active --quiet openstack-mistral-api - when: - - step|int == 0 - - mistral_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - tags: validation - - name: Stop and disable mistral_api service (pre-upgrade not under httpd) - when: - - step|int == 2 - - mistral_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - service: name=openstack-mistral-api state=stopped enabled=no - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if mistral_api_wsgi is running" - shell: systemctl status 'httpd' | grep -q mistral - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop mistral_api service (running under httpd) - service: name=httpd state=stopped enabled=no - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 + block: + - name: Check if mistral api is deployed + command: systemctl is-enabled --quiet openstack-mistral-api + ignore_errors: True + register: mistral_api_enabled_result + - set_fact: + mistral_api_enabled: "{{ mistral_api_enabled_result.rc == 0 }}" + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - name: Set fact httpd_running + when: httpd_running is undefined + set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + - name: Check for mistral_api running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q mistral" + ignore_errors: True + register: mistral_httpd_enabled_result + - set_fact: + mistral_httpd_enabled: "{{ mistral_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check if openstack-mistral-api is running" + command: systemctl is-active --quiet openstack-mistral-api + when: + - mistral_api_enabled|bool + tags: validation + - name: "PreUpgrade step0,validation: Check if mistral_api_wsgi is running" + shell: systemctl status 'httpd' | grep -q mistral + tags: validation + when: + - mistral_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable mistral_api service (pre-upgrade not under httpd) + when: + - mistral_api_enabled|bool + service: name=openstack-mistral-api state=stopped enabled=no + - name: Stop mistral_api service (running under httpd) + service: name=httpd state=stopped enabled=no + when: + - mistral_httpd_enabled|bool + - httpd_running|bool diff --git a/docker/services/nova-api.yaml b/docker/services/nova-api.yaml index 7dedfd7974..19243f7049 100644 --- a/docker/services/nova-api.yaml +++ b/docker/services/nova-api.yaml @@ -327,62 +327,63 @@ outputs: get_attr: [NovaApiBase, role_data, metadata_settings] host_prep_tasks: {get_attr: [NovaApiLogging, host_prep_tasks]} upgrade_tasks: - - name: Check if nova_api is deployed - command: systemctl is-enabled --quiet openstack-nova-api + - when: step|int == 0 tags: common - ignore_errors: True - register: nova_api_enabled - - name: Check for nova-api running under apache - tags: common - shell: httpd -t -D DUMP_VHOSTS | grep -q 'nova' - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-nova-api is running" - command: systemctl is-active --quiet openstack-nova-api - tags: validation - when: - - step|int == 0 - - nova_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Stop and disable nova_api service - when: - - step|int == 2 - - nova_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - service: name=openstack-nova-api state=stopped enabled=no - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if nova_wsgi is running" - tags: validation - shell: systemctl status 'httpd' | grep -q 'nova' - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop nova_api service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped - - name: Set fact for removal of openstack-nova-api package - when: step|int == 2 - set_fact: - remove_nova_api_package: {get_param: UpgradeRemoveUnusedPackages} - - name: Remove openstack-nova-api package if operator requests it - yum: name=openstack-nova-api state=removed - ignore_errors: True - when: - - step|int == 2 - - remove_nova_api_package|bool - - name: remove old nova cron jobs - when: step|int == 2 - file: - path: /var/spool/cron/nova - state: absent + block: + - name: Check if nova_api is deployed + command: systemctl is-enabled --quiet openstack-nova-api + ignore_errors: True + register: nova_api_enabled_result + - set_fact: + nova_api_enabled: "{{ nova_api_enabled_result.rc == 0 }}" + - name: Check for nova-api running under apache + shell: httpd -t -D DUMP_VHOSTS | grep -q 'nova' + ignore_errors: True + register: nova_api_httpd_enabled_result + - set_fact: + nova_api_httpd_enabled: "{{ nova_api_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-nova-api is running" + command: systemctl is-active --quiet openstack-nova-api + tags: validation + when: + - nova_api_enabled|bool + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if nova_wsgi is running" + tags: validation + shell: systemctl status 'httpd' | grep -q 'nova' + when: + - nova_api_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable nova_api service + when: + - nova_api_enabled|bool + service: name=openstack-nova-api state=stopped enabled=no + - name: Stop nova_api service (running under httpd) + when: + - nova_api_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped + - name: Set fact for removal of openstack-nova-api package + set_fact: + remove_nova_api_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-nova-api package if operator requests it + yum: name=openstack-nova-api state=removed + ignore_errors: True + when: + - remove_nova_api_package|bool + - name: remove old nova cron jobs + file: + path: /var/spool/cron/nova + state: absent fast_forward_upgrade_tasks: - name: Check if nova-api is deployed command: systemctl is-enabled --quiet openstack-nova-api diff --git a/docker/services/nova-placement.yaml b/docker/services/nova-placement.yaml index 3b7c310417..d9d352d2fa 100644 --- a/docker/services/nova-placement.yaml +++ b/docker/services/nova-placement.yaml @@ -152,36 +152,40 @@ outputs: get_attr: [NovaPlacementBase, role_data, metadata_settings] host_prep_tasks: {get_attr: [NovaPlacementLogging, host_prep_tasks]} upgrade_tasks: - - name: Check for nova placement running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q placement_wsgi" - ignore_errors: True - register: httpd_enabled - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if placement_wsgi is running" - shell: systemctl status 'httpd' | grep -q placement_wsgi - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop and disable nova_placement service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no - - name: Set fact for removal of httpd package - when: step|int == 2 - set_fact: - remove_httpd_package: {get_param: UpgradeRemoveUnusedPackages} - - name: Remove httpd package if operator requests it - yum: name=httpd state=removed - ignore_errors: True - when: - - step|int == 2 - - remove_httpd_package|bool + block: + - name: Check for nova placement running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q placement_wsgi" + ignore_errors: True + register: nova_placement_httpd_enabled + - set_fact: + nova_placement_httpd: "{{ nova_placement_httpd_enabled.rc == 0 }}" + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if placement_wsgi is running" + shell: systemctl status 'httpd' | grep -q placement_wsgi + tags: validation + when: + - nova_placement_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable nova_placement service (running under httpd) + when: + - nova_placement_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no + - name: Set fact for removal of httpd package + set_fact: + remove_httpd_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove httpd package if operator requests it + yum: name=httpd state=removed + ignore_errors: True + when: remove_httpd_package|bool diff --git a/docker/services/octavia-api.yaml b/docker/services/octavia-api.yaml index ebfe245706..0e80867ed0 100644 --- a/docker/services/octavia-api.yaml +++ b/docker/services/octavia-api.yaml @@ -195,44 +195,49 @@ outputs: /var/log/containers/octavia and /var/log/containers/httpd/octavia-api. ignore_errors: true upgrade_tasks: - - name: Check if octavia_api is deployed - command: systemctl is-enabled --quiet openstack-octavia-api + - when: step|int == 0 tags: common - ignore_errors: True - register: octavia_api_enabled - - name: Check for octavia-api running under apache - tags: common - shell: httpd -t -D DUMP_VHOSTS | grep -q 'octavia' - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service openstack-octavia-api is running" - command: systemctl is-active --quiet openstack-octavia-api - tags: validation - when: - - step|int == 0 - - octavia_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Stop and disable octavia_api service - service: name=openstack-octavia-api state=stopped enabled=no - when: - - step|int == 2 - - octavia_api_enabled.rc == 0 - - httpd_enabled.rc != 0 - - name: Check if httpd service is running - command: systemctl is-active --quiet httpd - tags: common - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if octavia_api_cfn_wsgi is running" - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - shell: systemctl status 'httpd' | grep -q 'octavia' - - name: Stop octavia_api service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped + block: + - name: Check if octavia_api is deployed + command: systemctl is-enabled --quiet openstack-octavia-api + ignore_errors: True + register: octavia_api_enabled_result + - name: Set fact octavia_api_enabled + set_fact: + octavia_api_enabled: "{{ octavia_api_enabled_result.rc == 0 }}" + - name: Check for octavia-api running under apache + shell: httpd -t -D DUMP_VHOSTS | grep -q 'octavia' + ignore_errors: True + register: octavia_api_httpd_enabled_result + - name: Set fact octavia_api_httpd_enabled + set_fact: + octavia_api_httpd_enabled: "{{ octavia_api_httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service openstack-octavia-api is running" + command: systemctl is-active --quiet openstack-octavia-api + tags: validation + when: octavia_api_enabled|bool + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - name: Set fact httpd_running + set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if octavia_api_cfn_wsgi is running" + tags: validation + when: + - octavia_api_httpd_enabled|bool + - httpd_running|bool + shell: systemctl status 'httpd' | grep -q 'octavia' + - when: step|int == 2 + block: + - name: Stop and disable octavia_api service + service: name=openstack-octavia-api state=stopped enabled=no + when: octavia_api_enabled|bool + - name: Stop octavia_api service (running under httpd) + when: + - octavia_api_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped diff --git a/docker/services/tripleo-ui.yaml b/docker/services/tripleo-ui.yaml index 6f5a0f3c46..f4cfc804ed 100644 --- a/docker/services/tripleo-ui.yaml +++ b/docker/services/tripleo-ui.yaml @@ -126,33 +126,39 @@ outputs: with_items: - /var/log/containers/httpd/tripleo-ui upgrade_tasks: - - name: Check for tripleo-ui service running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q tripleo-ui" - ignore_errors: True - register: httpd_enabled - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if tripleo-ui is running" - shell: systemctl status 'httpd' | grep -q tripleo-ui - tags: validation - when: - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - - name: Stop and disable tripleo-ui service (running under httpd) - when: - - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 - service: name=httpd state=stopped enabled=no - - name: Remove openstack-tripleo-ui package if operator requests it - yum: name=openstack-tripleo-ui state=removed - ignore_errors: True - when: - - step|int == 2 - - {get_param: UpgradeRemoveUnusedPackages} + block: + - name: Check for tripleo-ui service running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q tripleo-ui" + ignore_errors: True + register: tripleo_ui_httpd_enabled_result + - set_fact: + tripleo_ui_httpd_enabled: "{{ tripleo_ui_httpd_enabled_result.rc == 0 }}" + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if tripleo-ui is running" + shell: systemctl status 'httpd' | grep -q tripleo-ui + tags: validation + when: + - tripleo_ui_httpd_enabled|bool + - httpd_running|bool + - when: step|int == 2 + block: + - name: Stop and disable tripleo-ui service (running under httpd) + when: + - tripleo_ui_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no + - name: Remove openstack-tripleo-ui package if operator requests it + yum: name=openstack-tripleo-ui state=removed + ignore_errors: True + when: {get_param: UpgradeRemoveUnusedPackages} metadata_settings: get_attr: [TripleoUIPuppetBase, role_data, metadata_settings] diff --git a/docker/services/zaqar.yaml b/docker/services/zaqar.yaml index 8633402140..2856ea9a1f 100644 --- a/docker/services/zaqar.yaml +++ b/docker/services/zaqar.yaml @@ -195,28 +195,34 @@ outputs: /var/log/containers/zaqar and /var/log/containers/httpd/zaqar. ignore_errors: true upgrade_tasks: - - name: Check for zaqar running under apache + - when: step|int == 0 tags: common - shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi" - ignore_errors: True - register: httpd_enabled - - name: Check if httpd is running - tags: common - command: systemctl is-active --quiet httpd - ignore_errors: True - register: httpd_running - - name: "PreUpgrade step0,validation: Check if zaqar_wsgi is running" - shell: systemctl status 'httpd' | grep -q zaqar_wsgi - tags: validation - when: - - step|int == 0 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 + block: + - name: Check for zaqar running under apache + shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi" + ignore_errors: True + register: zaqar_httpd_enabled_result + - set_fact: + zaqar_httpd_enabled: "{{ zaqar_httpd_enabled_result.rc == 0 }}" + - name: Check if httpd is running + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running_result + when: httpd_running is undefined + - set_fact: + httpd_running: "{{ httpd_running_result.rc == 0 }}" + when: httpd_running is undefined + - name: "PreUpgrade step0,validation: Check if zaqar_wsgi is running" + shell: systemctl status 'httpd' | grep -q zaqar_wsgi + tags: validation + when: + - zaqar_httpd_enabled|bool + - httpd_running|bool - name: Stop and disable zaqar service when: - step|int == 2 - - httpd_enabled.rc == 0 - - httpd_running.rc == 0 + - zaqar_httpd_enabled|bool + - httpd_running|bool service: name=httpd state=stopped enabled=no metadata_settings: get_attr: [ZaqarBase, role_data, metadata_settings] diff --git a/puppet/services/apache.j2.yaml b/puppet/services/apache.j2.yaml index 41103550db..7b2741866f 100644 --- a/puppet/services/apache.j2.yaml +++ b/puppet/services/apache.j2.yaml @@ -132,17 +132,23 @@ outputs: $NETWORK: {get_attr: [ApacheNetworks, value]} - null upgrade_tasks: - - name: Check if httpd is deployed - command: systemctl is-enabled httpd +{% raw %} + - when: step|int == 0 tags: common - ignore_errors: True - register: httpd_enabled - - name: "PreUpgrade step0,validation: Check service httpd is running" - shell: /usr/bin/systemctl show 'httpd' --property ActiveState | grep '\bactive\b' - when: - - step|int == 0 - - httpd_enabled.rc == 0 - tags: validation - - name: Ensure mod_ssl package is installed - when: step|int == 3 - yum: name=mod_ssl state=latest + block: + - name: Check if httpd is deployed + command: systemctl is-enabled httpd + ignore_errors: True + register: httpd_enabled_result + - name: Set fact httpd_enabled + set_fact: + httpd_enabled: "{{ httpd_enabled_result.rc == 0 }}" + - name: "PreUpgrade step0,validation: Check service httpd is running" + shell: /usr/bin/systemctl show 'httpd' --property ActiveState | grep '\bactive\b' + when: httpd_enabled|bool + tags: validation + - when: step|int == 3 + block: + - name: Ensure mod_ssl package is installed + yum: name=mod_ssl state=latest +{% endraw %}