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
This commit is contained in:
Lukas Bezdicka
2018-03-23 14:47:34 +01:00
parent 25f583c640
commit 81db32ca8c
14 changed files with 529 additions and 460 deletions

View File

@@ -169,39 +169,45 @@ outputs:
/var/log/containers/aodh and /var/log/containers/httpd/aodh-api. /var/log/containers/aodh and /var/log/containers/httpd/aodh-api.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check for aodh api service running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q aodh" block:
ignore_errors: True - name: Check for aodh api service running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q aodh"
- name: Check if httpd is running ignore_errors: True
tags: common register: aodh_httpd_enabled_result
command: systemctl is-active --quiet httpd - name: Set fact aodh_httpd_enabled
ignore_errors: True set_fact:
register: httpd_running aodh_httpd_enabled: "{{ aodh_httpd_enabled_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check if aodh api is running" - name: Check if httpd is running
shell: systemctl status 'httpd' | grep -q aodh command: systemctl is-active --quiet httpd
tags: validation ignore_errors: True
when: register: httpd_running_result
- step|int == 0 when: httpd_running is undefined
- httpd_enabled.rc == 0 - name: Set fact httpd_running
- httpd_running.rc == 0 set_fact:
- name: Stop and disable aodh service (running under httpd) httpd_running: "{{ httpd_running_result.rc == 0 }}"
when: when: httpd_running is undefined
- step|int == 2 - name: "PreUpgrade step0,validation: Check if aodh api is running"
- httpd_enabled.rc == 0 shell: systemctl status 'httpd' | grep -q aodh
- httpd_running.rc == 0 tags: validation
service: name=httpd state=stopped enabled=no when:
- name: Set fact for removal of openstack-aodh-api package - aodh_httpd_enabled|bool
when: step|int == 2 - httpd_running|bool
set_fact: - when: step|int == 2
remove_aodh_api_package: {get_param: UpgradeRemoveUnusedPackages} block:
- name: Remove openstack-aodh-api package if operator requests it - name: Stop and disable aodh service (running under httpd)
yum: name=openstack-aodh-api state=removed when:
ignore_errors: True - aodh_httpd_enabled|bool
when: - httpd_running|bool
- step|int == 2 service: name=httpd state=stopped enabled=no
- remove_aodh_api_package|bool - 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: metadata_settings:
get_attr: [AodhApiPuppetBase, role_data, metadata_settings] get_attr: [AodhApiPuppetBase, role_data, metadata_settings]
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:

View File

@@ -222,47 +222,54 @@ outputs:
path: /etc/ceph path: /etc/ceph
state: directory state: directory
upgrade_tasks: upgrade_tasks:
- name: Check if gnocchi_api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-gnocchi-api
tags: common tags: common
ignore_errors: True block:
register: gnocchi_api_enabled - name: Check if gnocchi_api is deployed
- name: Check for gnocchi_api running under apache command: systemctl is-enabled --quiet openstack-gnocchi-api
tags: common ignore_errors: True
shell: "httpd -t -D DUMP_VHOSTS | grep -q gnocchi" register: gnocchi_api_enabled_result
ignore_errors: True - name: Set fact gnocchi_api_enabled
register: httpd_enabled set_fact:
- name: "PreUpgrade step0,validation: Check service openstack-gnocchi-api is running" gnocchi_api_enabled: "{{ gnocchi_api_enabled_result.rc == 0 }}"
command: systemctl is-active --quiet openstack-gnocchi-api - name: "PreUpgrade step0,validation: Check service openstack-gnocchi-api is running"
when: command: systemctl is-active --quiet openstack-gnocchi-api
- step|int == 0 when:
- gnocchi_api_enabled.rc == 0 - gnocchi_api_enabled|bool
- httpd_enabled.rc != 0 tags: validation
tags: validation - name: Check if httpd service is running
- name: Stop and disable gnocchi_api service command: systemctl is-active --quiet httpd
service: name=openstack-gnocchi-api state=stopped enabled=no ignore_errors: True
when: register: httpd_running_result
- step|int == 2 when: httpd_running is undefined
- gnocchi_api_enabled.rc == 0 - name: Set fact httpd_running
- httpd_enabled.rc != 0 set_fact:
- name: Check if httpd service is running httpd_running: "{{ httpd_running_result.rc == 0 }}"
command: systemctl is-active --quiet httpd when: httpd_running is undefined
tags: common - name: Check for gnocchi_api running under apache
ignore_errors: True shell: "httpd -t -D DUMP_VHOSTS | grep -q gnocchi"
register: httpd_running ignore_errors: True
- name: "PreUpgrade step0,validation: Check if gnocchi_api_wsgi is running" register: gnocchi_httpd_enabled_result
shell: systemctl status 'httpd' | grep -q gnocchi - name: set fact gnocchi_httpd_enabled
tags: validation set_fact:
when: gnocchi_httpd_enabled: "{{ gnocchi_httpd_enabled_result.rc == 0 }}"
- step|int == 0 - name: "PreUpgrade step0,validation: Check if gnocchi_api_wsgi is running"
- httpd_enabled.rc == 0 shell: systemctl status 'httpd' | grep -q gnocchi
- httpd_running.rc == 0 tags: validation
- name: Stop and disable httpd service when:
when: - gnocchi_httpd_enabled|bool
- step|int == 2 - httpd_running|bool
- httpd_enabled.rc == 0 - when: step|int == 2
- httpd_running.rc == 0 block:
service: name=httpd state=stopped enabled=no - 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: metadata_settings:
get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings] get_attr: [GnocchiApiPuppetBase, role_data, metadata_settings]
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:

View File

@@ -142,47 +142,51 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check if heat_api_cfn is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-heat-api-cfn
tags: common tags: common
ignore_errors: True block:
register: heat_api_cfn_enabled - name: Check if heat_api_cfn is deployed
- name: Check for heat_api_cfn running under apache command: systemctl is-enabled --quiet openstack-heat-api-cfn
tags: common ignore_errors: True
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi" register: heat_api_cfn_enabled_result
ignore_errors: True - set_fact:
register: httpd_enabled heat_api_cfn_enabled: heat_api_cfn_enabled_result|bool
- name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running" - name: Check for heat_api_cfn running under apache
command: systemctl is-active --quiet openstack-heat-api-cfn shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
when: ignore_errors: True
- step|int == 0 register: heat_api_cfn_httpd_enabled_result
- heat_api_cfn_enabled.rc == 0 - set_fact:
- httpd_enabled.rc != 0 heat_api_cfn_httpd_enabled: "{{ heat_api_cfn_httpd_enabled_result.rc == 0 }}"
tags: validation - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running"
- name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd) command: systemctl is-active --quiet openstack-heat-api-cfn
service: name=openstack-heat-api-cfn state=stopped enabled=no when:
when: - heat_api_cfn_enabled|bool
- step|int == 2 tags: validation
- heat_api_cfn_enabled.rc == 0 - name: Check if httpd service is running
- httpd_enabled.rc != 0 command: systemctl is-active --quiet httpd
- name: Check if httpd service is running ignore_errors: True
command: systemctl is-active --quiet httpd register: httpd_running_result
tags: common when: httpd_running is undefined
ignore_errors: True - set_fact:
register: httpd_running httpd_running: "{{ httpd_running_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running" when: httpd_running is undefined
tags: validation - name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running"
shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi tags: validation
when: shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi
- step|int == 0 when:
- httpd_enabled.rc == 0 - heat_api_cfn_httpd_enabled|bool
- httpd_running.rc == 0 - httpd_running|bool
- name: Stop heat_api_cfn service (running under httpd) - when: step|int == 2
service: name=httpd state=stopped block:
when: - name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
- step|int == 2 service: name=openstack-heat-api-cfn state=stopped enabled=no
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - 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: metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings] get_attr: [HeatBase, role_data, metadata_settings]
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:

View File

@@ -180,52 +180,55 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check if heat_api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-heat-api
tags: common tags: common
ignore_errors: True block:
register: heat_api_enabled - name: Check if heat_api is deployed
- name: Check for heat_api running under apache command: systemctl is-enabled --quiet openstack-heat-api
tags: common ignore_errors: True
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi" register: heat_api_enabled_result
ignore_errors: True - set_fact:
register: httpd_enabled heat_api_enabled: "{{ heat_api_enabled_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check service openstack-heat-api is running" - name: Check for heat_api running under apache
command: systemctl is-active --quiet openstack-heat-api shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi"
when: ignore_errors: True
- step|int == 0 register: heat_api_httpd_enabled_result
- heat_api_enabled.rc == 0 - set_fact:
- httpd_enabled.rc != 0 heat_api_httpd_enabled: "{{ heat_api_httpd_enabled_result.rc == 0 }}"
tags: validation - name: "PreUpgrade step0,validation: Check service openstack-heat-api is running"
- name: Stop and disable heat_api service (pre-upgrade not under httpd) command: systemctl is-active --quiet openstack-heat-api
service: name=openstack-heat-api state=stopped enabled=no when:
when: - heat_api_enabled|bool
- step|int == 2 tags: validation
- heat_api_enabled.rc == 0 - name: Check if httpd is running
- httpd_enabled.rc != 0 command: systemctl is-active --quiet httpd
- name: Check if httpd is running ignore_errors: True
tags: common register: httpd_running_result
command: systemctl is-active --quiet httpd when: httpd_running is undefined
ignore_errors: True - set_fact:
register: httpd_running httpd_running: "{{ httpd_running_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running" when: httpd_running is undefined
shell: systemctl status 'httpd' | grep -q heat_api_wsgi - name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running"
tags: validation shell: systemctl status 'httpd' | grep -q heat_api_wsgi
when: tags: validation
- step|int == 0 when:
- httpd_enabled.rc == 0 - heat_api_httpd_enabled|bool
- httpd_running.rc == 0 - httpd_running|bool
- name: Stop heat_api service (running under httpd) - when: step|int == 2
service: name=httpd state=stopped block:
when: - name: Stop and disable heat_api service (pre-upgrade not under httpd)
- step|int == 2 service: name=openstack-heat-api state=stopped enabled=no
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - heat_api_enabled|bool
- name: remove old heat cron jobs - name: Stop heat_api service (running under httpd)
when: step|int == 2 service: name=httpd state=stopped
file: when:
path: /var/spool/cron/heat - heat_api_httpd_enabled|bool
state: absent - httpd_running|bool
- name: remove old heat cron jobs
file:
path: /var/spool/cron/heat
state: absent
metadata_settings: metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings] get_attr: [HeatBase, role_data, metadata_settings]
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:

View File

@@ -187,21 +187,24 @@ outputs:
/var/log/containers/horizon and /var/log/containers/httpd/horizon. /var/log/containers/horizon and /var/log/containers/httpd/horizon.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check for horizon running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q horizon_vhost" block:
ignore_errors: True - name: Check for horizon running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q horizon_vhost"
- name: "PreUpgrade step0,validation: Check if horizon is running" ignore_errors: True
shell: systemctl is-active --quiet httpd register: horizon_httpd_enabled_result
when: - set_fact:
- step|int == 0 horizon_httpd_enabled: "{{ horizon_httpd_enabled_result.rc == 0 }}"
- httpd_enabled.rc == 0 - name: "PreUpgrade step0,validation: Check if horizon is running"
tags: validation shell: systemctl is-active --quiet httpd
when:
- horizon_httpd_enabled|bool
tags: validation
- name: Stop and disable horizon service (running under httpd) - name: Stop and disable horizon service (running under httpd)
when: when:
- step|int == 2 - step|int == 2
- httpd_enabled.rc == 0 - horizon_httpd_enabled|bool
service: name=httpd state=stopped enabled=no service: name=httpd state=stopped enabled=no
metadata_settings: metadata_settings:
get_attr: [HorizonBase, role_data, metadata_settings] get_attr: [HorizonBase, role_data, metadata_settings]

View File

@@ -151,47 +151,54 @@ outputs:
/var/log/containers/ironic and /var/log/containers/httpd/ironic-*. /var/log/containers/ironic and /var/log/containers/httpd/ironic-*.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check if ironic_api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-ironic-api
tags: common tags: common
ignore_errors: True block:
register: ironic_api_enabled - name: Check if ironic_api is deployed
- name: Check for ironic_api running under apache command: systemctl is-enabled --quiet openstack-ironic-api
tags: common ignore_errors: True
shell: "httpd -t -D DUMP_VHOSTS | grep -q ironic" register: ironic_api_enabled_result
ignore_errors: True - name: Set fact ironic_api_enabled
register: httpd_enabled set_fact:
- name: "PreUpgrade step0,validation: Check service openstack-ironic-api is running" ironic_api_enabled: "{{ ironic_api_enabled_result.rc == 0 }}"
command: systemctl is-active --quiet openstack-ironic-api - name: Check for ironic_api running under apache
when: shell: "httpd -t -D DUMP_VHOSTS | grep -q ironic"
- step|int == 0 ignore_errors: True
- ironic_api_enabled.rc == 0 register: ironic_httpd_enabled_result
- httpd_enabled.rc != 0 - name: Set fact ironic_httpd_enabled
tags: validation set_fact:
- name: Stop and disable ironic_api service ironic_httpd_enabled: "{{ ironic_httpd_enabled_result.rc == 0 }}"
when: - name: "PreUpgrade step0,validation: Check service openstack-ironic-api is running"
- step|int == 2 command: systemctl is-active --quiet openstack-ironic-api
- ironic_api_enabled.rc == 0 when:
- httpd_enabled.rc != 0 - ironic_api_enabled|bool
service: name=openstack-ironic-api state=stopped enabled=no tags: validation
- name: Check if httpd service is running - name: Check if httpd service is running
command: systemctl is-active --quiet httpd command: systemctl is-active --quiet httpd
tags: common ignore_errors: True
ignore_errors: True register: httpd_running_result
register: httpd_running when: httpd_running is undefined
- name: "PreUpgrade step0,validation: Check if ironic_api_wsgi is running" - name: Set fact httpd_running
shell: systemctl status 'httpd' | grep -q ironic set_fact:
tags: validation httpd_running: "{{ httpd_running_result.rc == 0 }}"
when: when: httpd_running is undefined
- step|int == 0 - name: "PreUpgrade step0,validation: Check if ironic_api_wsgi is running"
- httpd_enabled.rc == 0 shell: systemctl status 'httpd' | grep -q ironic
- httpd_running.rc == 0 tags: validation
- name: Stop ironic_api service (running under httpd) when:
when: - ironic_httpd_enabled|bool
- step|int == 2 - httpd_running|bool
- httpd_enabled.rc == 0 - when: step|int == 2
- httpd_running.rc == 0 block:
service: name=httpd state=stopped enabled=no - 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: fast_forward_upgrade_tasks:
- block: - block:
- name: Check if ironic_api is deployed - name: Check if ironic_api is deployed

View File

@@ -221,34 +221,40 @@ outputs:
config_image: *keystone_config_image config_image: *keystone_config_image
host_prep_tasks: {get_attr: [KeystoneLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [KeystoneLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check for keystone running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q keystone_wsgi" block:
ignore_errors: True - name: Check for keystone running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q keystone_wsgi"
- name: Check if httpd is running ignore_errors: True
tags: common register: keystone_httpd_enabled_result
command: systemctl is-active --quiet httpd - set_fact:
ignore_errors: True keystone_httpd_enabled: "{{ keystone_httpd_enabled_result.rc == 0 }}"
register: httpd_running - name: Check if httpd is running
- name: "PreUpgrade step0,validation: Check if keystone_wsgi is running under httpd" command: systemctl is-active --quiet httpd
shell: systemctl status 'httpd' | grep -q keystone ignore_errors: True
tags: validation register: httpd_running_result
when: when: httpd_running is undefined
- step|int == 0 - set_fact:
- httpd_enabled.rc == 0 httpd_running: "{{ httpd_running_result.rc == 0 }}"
- httpd_running.rc == 0 when: httpd_running is undefined
- name: Stop and disable keystone service (running under httpd) - name: "PreUpgrade step0,validation: Check if keystone_wsgi is running under httpd"
when: shell: systemctl status 'httpd' | grep -q keystone
- step|int == 2 tags: validation
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - keystone_httpd_enabled|bool
service: name=httpd state=stopped enabled=no - httpd_running|bool
- name: remove old keystone cron jobs - when: step|int == 2
when: step|int == 2 block:
file: - name: Stop and disable keystone service (running under httpd)
path: /var/spool/cron/keystone when:
state: absent - 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: metadata_settings:
get_attr: [KeystoneBase, role_data, metadata_settings] get_attr: [KeystoneBase, role_data, metadata_settings]
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:

View File

@@ -161,44 +161,49 @@ outputs:
/var/log/containers/mistral. /var/log/containers/mistral.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check if mistral api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-mistral-api
tags: common tags: common
ignore_errors: True block:
register: mistral_api_enabled - name: Check if mistral api is deployed
- name: Check for mistral_api running under apache command: systemctl is-enabled --quiet openstack-mistral-api
tags: common ignore_errors: True
shell: "httpd -t -D DUMP_VHOSTS | grep -q mistral" register: mistral_api_enabled_result
ignore_errors: True - set_fact:
register: httpd_enabled mistral_api_enabled: "{{ mistral_api_enabled_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check if openstack-mistral-api is running" - name: Check if httpd service is running
command: systemctl is-active --quiet openstack-mistral-api command: systemctl is-active --quiet httpd
when: ignore_errors: True
- step|int == 0 register: httpd_running_result
- mistral_api_enabled.rc == 0 when: httpd_running is undefined
- httpd_enabled.rc != 0 - name: Set fact httpd_running
tags: validation when: httpd_running is undefined
- name: Stop and disable mistral_api service (pre-upgrade not under httpd) set_fact:
when: httpd_running: "{{ httpd_running_result.rc == 0 }}"
- step|int == 2 - name: Check for mistral_api running under apache
- mistral_api_enabled.rc == 0 shell: "httpd -t -D DUMP_VHOSTS | grep -q mistral"
- httpd_enabled.rc != 0 ignore_errors: True
service: name=openstack-mistral-api state=stopped enabled=no register: mistral_httpd_enabled_result
- name: Check if httpd service is running - set_fact:
command: systemctl is-active --quiet httpd mistral_httpd_enabled: "{{ mistral_httpd_enabled_result.rc == 0 }}"
tags: common - name: "PreUpgrade step0,validation: Check if openstack-mistral-api is running"
ignore_errors: True command: systemctl is-active --quiet openstack-mistral-api
register: httpd_running when:
- name: "PreUpgrade step0,validation: Check if mistral_api_wsgi is running" - mistral_api_enabled|bool
shell: systemctl status 'httpd' | grep -q mistral tags: validation
tags: validation - name: "PreUpgrade step0,validation: Check if mistral_api_wsgi is running"
when: shell: systemctl status 'httpd' | grep -q mistral
- step|int == 0 tags: validation
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - mistral_httpd_enabled|bool
- name: Stop mistral_api service (running under httpd) - httpd_running|bool
service: name=httpd state=stopped enabled=no - when: step|int == 2
when: block:
- step|int == 2 - name: Stop and disable mistral_api service (pre-upgrade not under httpd)
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - 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

View File

@@ -327,62 +327,63 @@ outputs:
get_attr: [NovaApiBase, role_data, metadata_settings] get_attr: [NovaApiBase, role_data, metadata_settings]
host_prep_tasks: {get_attr: [NovaApiLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [NovaApiLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check if nova_api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-nova-api
tags: common tags: common
ignore_errors: True block:
register: nova_api_enabled - name: Check if nova_api is deployed
- name: Check for nova-api running under apache command: systemctl is-enabled --quiet openstack-nova-api
tags: common ignore_errors: True
shell: httpd -t -D DUMP_VHOSTS | grep -q 'nova' register: nova_api_enabled_result
ignore_errors: True - set_fact:
register: httpd_enabled nova_api_enabled: "{{ nova_api_enabled_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check service openstack-nova-api is running" - name: Check for nova-api running under apache
command: systemctl is-active --quiet openstack-nova-api shell: httpd -t -D DUMP_VHOSTS | grep -q 'nova'
tags: validation ignore_errors: True
when: register: nova_api_httpd_enabled_result
- step|int == 0 - set_fact:
- nova_api_enabled.rc == 0 nova_api_httpd_enabled: "{{ nova_api_httpd_enabled_result.rc == 0 }}"
- httpd_enabled.rc != 0 - name: "PreUpgrade step0,validation: Check service openstack-nova-api is running"
- name: Stop and disable nova_api service command: systemctl is-active --quiet openstack-nova-api
when: tags: validation
- step|int == 2 when:
- nova_api_enabled.rc == 0 - nova_api_enabled|bool
- httpd_enabled.rc != 0 - name: Check if httpd service is running
service: name=openstack-nova-api state=stopped enabled=no command: systemctl is-active --quiet httpd
- name: Check if httpd service is running ignore_errors: True
command: systemctl is-active --quiet httpd register: httpd_running_result
tags: common when: httpd_running is undefined
ignore_errors: True - set_fact:
register: httpd_running httpd_running: "{{ httpd_running_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check if nova_wsgi is running" when: httpd_running is undefined
tags: validation - name: "PreUpgrade step0,validation: Check if nova_wsgi is running"
shell: systemctl status 'httpd' | grep -q 'nova' tags: validation
when: shell: systemctl status 'httpd' | grep -q 'nova'
- step|int == 0 when:
- httpd_enabled.rc == 0 - nova_api_httpd_enabled|bool
- httpd_running.rc == 0 - httpd_running|bool
- name: Stop nova_api service (running under httpd) - when: step|int == 2
when: block:
- step|int == 2 - name: Stop and disable nova_api service
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - nova_api_enabled|bool
service: name=httpd state=stopped service: name=openstack-nova-api state=stopped enabled=no
- name: Set fact for removal of openstack-nova-api package - name: Stop nova_api service (running under httpd)
when: step|int == 2 when:
set_fact: - nova_api_httpd_enabled|bool
remove_nova_api_package: {get_param: UpgradeRemoveUnusedPackages} - httpd_running|bool
- name: Remove openstack-nova-api package if operator requests it service: name=httpd state=stopped
yum: name=openstack-nova-api state=removed - name: Set fact for removal of openstack-nova-api package
ignore_errors: True set_fact:
when: remove_nova_api_package: {get_param: UpgradeRemoveUnusedPackages}
- step|int == 2 - name: Remove openstack-nova-api package if operator requests it
- remove_nova_api_package|bool yum: name=openstack-nova-api state=removed
- name: remove old nova cron jobs ignore_errors: True
when: step|int == 2 when:
file: - remove_nova_api_package|bool
path: /var/spool/cron/nova - name: remove old nova cron jobs
state: absent file:
path: /var/spool/cron/nova
state: absent
fast_forward_upgrade_tasks: fast_forward_upgrade_tasks:
- name: Check if nova-api is deployed - name: Check if nova-api is deployed
command: systemctl is-enabled --quiet openstack-nova-api command: systemctl is-enabled --quiet openstack-nova-api

View File

@@ -152,36 +152,40 @@ outputs:
get_attr: [NovaPlacementBase, role_data, metadata_settings] get_attr: [NovaPlacementBase, role_data, metadata_settings]
host_prep_tasks: {get_attr: [NovaPlacementLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [NovaPlacementLogging, host_prep_tasks]}
upgrade_tasks: upgrade_tasks:
- name: Check for nova placement running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q placement_wsgi" block:
ignore_errors: True - name: Check for nova placement running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q placement_wsgi"
- name: Check if httpd is running ignore_errors: True
tags: common register: nova_placement_httpd_enabled
command: systemctl is-active --quiet httpd - set_fact:
ignore_errors: True nova_placement_httpd: "{{ nova_placement_httpd_enabled.rc == 0 }}"
register: httpd_running - name: Check if httpd is running
- name: "PreUpgrade step0,validation: Check if placement_wsgi is running" command: systemctl is-active --quiet httpd
shell: systemctl status 'httpd' | grep -q placement_wsgi ignore_errors: True
tags: validation register: httpd_running_result
when: when: httpd_running is undefined
- step|int == 0 - set_fact:
- httpd_enabled.rc == 0 httpd_running: "{{ httpd_running_result.rc == 0 }}"
- httpd_running.rc == 0 when: httpd_running is undefined
- name: Stop and disable nova_placement service (running under httpd) - name: "PreUpgrade step0,validation: Check if placement_wsgi is running"
when: shell: systemctl status 'httpd' | grep -q placement_wsgi
- step|int == 2 tags: validation
- httpd_enabled.rc == 0 when:
- httpd_running.rc == 0 - nova_placement_httpd_enabled|bool
service: name=httpd state=stopped enabled=no - httpd_running|bool
- name: Set fact for removal of httpd package - when: step|int == 2
when: step|int == 2 block:
set_fact: - name: Stop and disable nova_placement service (running under httpd)
remove_httpd_package: {get_param: UpgradeRemoveUnusedPackages} when:
- name: Remove httpd package if operator requests it - nova_placement_httpd_enabled|bool
yum: name=httpd state=removed - httpd_running|bool
ignore_errors: True service: name=httpd state=stopped enabled=no
when: - name: Set fact for removal of httpd package
- step|int == 2 set_fact:
- remove_httpd_package|bool 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

View File

@@ -195,44 +195,49 @@ outputs:
/var/log/containers/octavia and /var/log/containers/httpd/octavia-api. /var/log/containers/octavia and /var/log/containers/httpd/octavia-api.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check if octavia_api is deployed - when: step|int == 0
command: systemctl is-enabled --quiet openstack-octavia-api
tags: common tags: common
ignore_errors: True block:
register: octavia_api_enabled - name: Check if octavia_api is deployed
- name: Check for octavia-api running under apache command: systemctl is-enabled --quiet openstack-octavia-api
tags: common ignore_errors: True
shell: httpd -t -D DUMP_VHOSTS | grep -q 'octavia' register: octavia_api_enabled_result
ignore_errors: True - name: Set fact octavia_api_enabled
register: httpd_enabled set_fact:
- name: "PreUpgrade step0,validation: Check service openstack-octavia-api is running" octavia_api_enabled: "{{ octavia_api_enabled_result.rc == 0 }}"
command: systemctl is-active --quiet openstack-octavia-api - name: Check for octavia-api running under apache
tags: validation shell: httpd -t -D DUMP_VHOSTS | grep -q 'octavia'
when: ignore_errors: True
- step|int == 0 register: octavia_api_httpd_enabled_result
- octavia_api_enabled.rc == 0 - name: Set fact octavia_api_httpd_enabled
- httpd_enabled.rc != 0 set_fact:
- name: Stop and disable octavia_api service octavia_api_httpd_enabled: "{{ octavia_api_httpd_enabled_result.rc == 0 }}"
service: name=openstack-octavia-api state=stopped enabled=no - name: "PreUpgrade step0,validation: Check service openstack-octavia-api is running"
when: command: systemctl is-active --quiet openstack-octavia-api
- step|int == 2 tags: validation
- octavia_api_enabled.rc == 0 when: octavia_api_enabled|bool
- httpd_enabled.rc != 0 - name: Check if httpd service is running
- name: Check if httpd service is running command: systemctl is-active --quiet httpd
command: systemctl is-active --quiet httpd ignore_errors: True
tags: common register: httpd_running_result
ignore_errors: True when: httpd_running is undefined
register: httpd_running - name: Set fact httpd_running
- name: "PreUpgrade step0,validation: Check if octavia_api_cfn_wsgi is running" set_fact:
tags: validation httpd_running: "{{ httpd_running_result.rc == 0 }}"
when: when: httpd_running is undefined
- step|int == 0 - name: "PreUpgrade step0,validation: Check if octavia_api_cfn_wsgi is running"
- httpd_enabled.rc == 0 tags: validation
- httpd_running.rc == 0 when:
shell: systemctl status 'httpd' | grep -q 'octavia' - octavia_api_httpd_enabled|bool
- name: Stop octavia_api service (running under httpd) - httpd_running|bool
when: shell: systemctl status 'httpd' | grep -q 'octavia'
- step|int == 2 - when: step|int == 2
- httpd_enabled.rc == 0 block:
- httpd_running.rc == 0 - name: Stop and disable octavia_api service
service: name=httpd state=stopped 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

View File

@@ -126,33 +126,39 @@ outputs:
with_items: with_items:
- /var/log/containers/httpd/tripleo-ui - /var/log/containers/httpd/tripleo-ui
upgrade_tasks: upgrade_tasks:
- name: Check for tripleo-ui service running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q tripleo-ui" block:
ignore_errors: True - name: Check for tripleo-ui service running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q tripleo-ui"
- name: Check if httpd is running ignore_errors: True
tags: common register: tripleo_ui_httpd_enabled_result
command: systemctl is-active --quiet httpd - set_fact:
ignore_errors: True tripleo_ui_httpd_enabled: "{{ tripleo_ui_httpd_enabled_result.rc == 0 }}"
register: httpd_running - name: Check if httpd is running
- name: "PreUpgrade step0,validation: Check if tripleo-ui is running" command: systemctl is-active --quiet httpd
shell: systemctl status 'httpd' | grep -q tripleo-ui ignore_errors: True
tags: validation register: httpd_running_result
when: when: httpd_running is undefined
- httpd_enabled.rc == 0 - set_fact:
- httpd_running.rc == 0 httpd_running: "{{ httpd_running_result.rc == 0 }}"
- name: Stop and disable tripleo-ui service (running under httpd) when: httpd_running is undefined
when: - name: "PreUpgrade step0,validation: Check if tripleo-ui is running"
- step|int == 2 shell: systemctl status 'httpd' | grep -q tripleo-ui
- httpd_enabled.rc == 0 tags: validation
- httpd_running.rc == 0 when:
service: name=httpd state=stopped enabled=no - tripleo_ui_httpd_enabled|bool
- name: Remove openstack-tripleo-ui package if operator requests it - httpd_running|bool
yum: name=openstack-tripleo-ui state=removed - when: step|int == 2
ignore_errors: True block:
when: - name: Stop and disable tripleo-ui service (running under httpd)
- step|int == 2 when:
- {get_param: UpgradeRemoveUnusedPackages} - 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: metadata_settings:
get_attr: [TripleoUIPuppetBase, role_data, metadata_settings] get_attr: [TripleoUIPuppetBase, role_data, metadata_settings]

View File

@@ -195,28 +195,34 @@ outputs:
/var/log/containers/zaqar and /var/log/containers/httpd/zaqar. /var/log/containers/zaqar and /var/log/containers/httpd/zaqar.
ignore_errors: true ignore_errors: true
upgrade_tasks: upgrade_tasks:
- name: Check for zaqar running under apache - when: step|int == 0
tags: common tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi" block:
ignore_errors: True - name: Check for zaqar running under apache
register: httpd_enabled shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi"
- name: Check if httpd is running ignore_errors: True
tags: common register: zaqar_httpd_enabled_result
command: systemctl is-active --quiet httpd - set_fact:
ignore_errors: True zaqar_httpd_enabled: "{{ zaqar_httpd_enabled_result.rc == 0 }}"
register: httpd_running - name: Check if httpd is running
- name: "PreUpgrade step0,validation: Check if zaqar_wsgi is running" command: systemctl is-active --quiet httpd
shell: systemctl status 'httpd' | grep -q zaqar_wsgi ignore_errors: True
tags: validation register: httpd_running_result
when: when: httpd_running is undefined
- step|int == 0 - set_fact:
- httpd_enabled.rc == 0 httpd_running: "{{ httpd_running_result.rc == 0 }}"
- httpd_running.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 - name: Stop and disable zaqar service
when: when:
- step|int == 2 - step|int == 2
- httpd_enabled.rc == 0 - zaqar_httpd_enabled|bool
- httpd_running.rc == 0 - httpd_running|bool
service: name=httpd state=stopped enabled=no service: name=httpd state=stopped enabled=no
metadata_settings: metadata_settings:
get_attr: [ZaqarBase, role_data, metadata_settings] get_attr: [ZaqarBase, role_data, metadata_settings]

View File

@@ -132,17 +132,23 @@ outputs:
$NETWORK: {get_attr: [ApacheNetworks, value]} $NETWORK: {get_attr: [ApacheNetworks, value]}
- null - null
upgrade_tasks: upgrade_tasks:
- name: Check if httpd is deployed {% raw %}
command: systemctl is-enabled httpd - when: step|int == 0
tags: common tags: common
ignore_errors: True block:
register: httpd_enabled - name: Check if httpd is deployed
- name: "PreUpgrade step0,validation: Check service httpd is running" command: systemctl is-enabled httpd
shell: /usr/bin/systemctl show 'httpd' --property ActiveState | grep '\bactive\b' ignore_errors: True
when: register: httpd_enabled_result
- step|int == 0 - name: Set fact httpd_enabled
- httpd_enabled.rc == 0 set_fact:
tags: validation httpd_enabled: "{{ httpd_enabled_result.rc == 0 }}"
- name: Ensure mod_ssl package is installed - name: "PreUpgrade step0,validation: Check service httpd is running"
when: step|int == 3 shell: /usr/bin/systemctl show 'httpd' --property ActiveState | grep '\bactive\b'
yum: name=mod_ssl state=latest 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 %}