Add validation task in docker services [Mixed-3]

Docker services are missing the pre-upgrade validation task
in the upgrade_tasks section which verifies if the service
is running before going on with the upgrade.

Change-Id: If2720b84a5ba5c074bab19fabcb8cb25baac6af5
Partial-Bug: #1704389
This commit is contained in:
Jose Luis Franco Arza 2017-09-20 11:55:53 +02:00
parent 9bd858ebdf
commit e238b20681
6 changed files with 74 additions and 14 deletions

View File

@ -160,10 +160,15 @@ outputs:
get_attr: [MongodbPuppetBase, role_data, metadata_settings]
upgrade_tasks:
- name: Check for mongodb service
stat: path=/usr/lib/systemd/system/mongod.service
command: systemctl is-enabled --quiet mongod
tags: common
register: mongod_service
ignore_errors: True
register: mongod_enabled
- name: "PreUpgrade step0,validation: Check if mongod is running"
command: systemctl is-active --quiet mongod
when: mongod_enabled.rc == 0
tags: step0,validation
- name: Stop and disable mongodb service
tags: step2
when: mongod_enabled.rc == 0
service: name=mongod state=stopped enabled=no
when: mongod_service.stat.exists

View File

@ -227,6 +227,16 @@ outputs:
- /var/log/containers/mysql
- /var/lib/mysql
upgrade_tasks:
- name: Check if mysql service is deployed
command: systemctl is-enabled --quiet mariadb
tags: common
ignore_errors: True
register: mariadb_enabled
- name: "PreUpgrade step0,validation: Check if mysql service is running"
command: systemctl is-active --quiet mariadb
when: mariadb_enabled.rc == 0
tags: step0,validation
- name: Stop and disable mysql service
tags: step2
when: mariadb_enabled.rc == 0
service: name=mariadb state=stopped enabled=no

View File

@ -104,19 +104,29 @@ outputs:
service: name=iscsid.socket state=stopped enabled=no
when: stat_iscsid_socket.stat.exists
upgrade_tasks:
- name: stat /lib/systemd/system/iscsid.service
tags: step2
stat: path=/lib/systemd/system/iscsid.service
register: stat_iscsid_service
- name: Check if iscsid service is deployed
tags: common
ignore_errors: True
command: systemctl is-enabled --quiet iscsid
register: iscsid_enabled
- name: "PreUpgrade step0,validation: Check if iscsid is running"
command: systemctl is-active --quiet iscsid
when: iscsid_enabled.rc == 0
tags: step0,validation
- name: Stop and disable iscsid service
tags: step2
when: iscsid_enabled.rc == 0
service: name=iscsid state=stopped enabled=no
when: (stat_iscsid_service.stat|default('')).exists|default(false)
- name: stat /lib/systemd/system/iscsid.socket
tags: step2
stat: path=/lib/systemd/system/iscsid.socket
register: stat_iscsid_socket
- name: Check if iscsid.socket service is deployed
tags: common
command: systemctl is-enabled --quiet iscsid.socket
ignore_errors: True
register: iscsid_socket_enabled
- name: "PreUpgrade step0,validation: Check if iscsid.socket is running"
command: systemctl is-active --quiet iscsid.socket
when: iscsid_socket_enabled.rc == 0
tags: step0,validation
- name: Stop and disable iscsid.socket service
tags: step2
when: iscsid_socket_enabled.rc == 0
service: name=iscsid.socket state=stopped enabled=no
when: (stat_iscsid_socket.stat|default('')).exists|default(false)

View File

@ -145,6 +145,16 @@ outputs:
path: /var/log/containers/sensu
state: directory
upgrade_tasks:
- name: Check if sensu client is deployed
command: systemctl is-enabled --quiet sensu-client
tags: common
ignore_errors: True
register: sensu_enabled
- name: "PreUpgrade step0,validation: Check if sensu client is running"
command: systemctl is-active --quiet sensu-client
when: sensu_enabled.rc == 0
tags: step0,validation
- name: Stop and disable sensu-client service
tags: step2
service: name=sensu-client.service state=stopped enabled=no
when: sensu_enabled.rc == 0
service: name=sensu-client state=stopped enabled=no

View File

@ -137,6 +137,16 @@ outputs:
path: /var/log/containers/tacker
state: directory
upgrade_tasks:
- name: Check if tacker is deployed
command: systemctl is-enabled --quiet openstack-tacker-server
tags: common
ignore_errors: True
register: tacker_enabled
- name: "PreUpgrade step0,validation: Check if tacker is running"
command: systemctl is-active --quiet openstack-tacker-server
when: tacker_enabled.rc == 0
tags: step0,validation
- name: Stop and disable tacker-server service
tags: step2
when: tacker_enabled.rc == 0
service: name=openstack-tacker-server state=stopped enabled=no

View File

@ -189,8 +189,23 @@ outputs:
- /var/log/containers/zaqar
- /var/log/containers/httpd/zaqar
upgrade_tasks:
- name: Check for zaqar running under apache
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: step0,validation
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: Stop and disable zaqar service
tags: step2
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
service: name=httpd state=stopped enabled=no
metadata_settings:
get_attr: [ZaqarBase, role_data, metadata_settings]