Merge "Add upgrade_tasks for HAproxy"

This commit is contained in:
Zuul 2018-07-26 20:56:17 +00:00 committed by Gerrit Code Review
commit eacde76516

@ -87,6 +87,10 @@ parameters:
default: false
description: Whether to run config management (e.g. Puppet) in debug mode.
type: boolean
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
type: boolean
conditions:
puppet_debug_enabled: {get_param: ConfigDebug}
@ -255,6 +259,33 @@ outputs:
- null
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
upgrade_tasks:
- when: step|int == 0
tags: common
block:
- name: Check if HAproxy is deployed
command: systemctl is-enabled --quiet haproxy
ignore_errors: True
register: haproxy_enabled_result
- name: Set fact haproxy_enabled
set_fact:
haproxy_enabled: "{{ haproxy_enabled_result.rc == 0 }}"
- name: "PreUpgrade step0,validation: Check service HAproxy is running"
command: systemctl is-active --quiet haproxy
tags: validation
when: haproxy_enabled|bool
- when: step|int == 2
block:
- name: Stop and disable haproxy service
when: haproxy_enabled|bool
service: name=haproxy state=stopped enabled=no
- name: Set fact for removal of HAproxy package
set_fact:
remove_haproxy_package: {get_param: UpgradeRemoveUnusedPackages}
- name: Remove HAproxy package if operator requests it
package: name=haproxy state=removed
ignore_errors: True
when: remove_haproxy_package|bool
host_prep_tasks:
- {get_attr: [HAProxyBase, role_data, host_prep_tasks]}
- name: create persistent directories