Add upgrade_tasks for HAproxy

Include the tasks that are necessary when upgrading a non-containerized
undercloud to a containerized undercloud for example.

Change-Id: I1e281711f1543659e7ec043747857b756beda3e1
This commit is contained in:
Juan Antonio Osorio Robles 2018-07-24 15:01:46 +03:00 committed by Emilien Macchi
parent d75fca71ed
commit 4b60adfce4
1 changed files with 31 additions and 0 deletions

View File

@ -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