From 4b60adfce435741ab0afc67983ac49ba9b91c9ee Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Tue, 24 Jul 2018 15:01:46 +0300 Subject: [PATCH] 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 --- docker/services/haproxy.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docker/services/haproxy.yaml b/docker/services/haproxy.yaml index b44856687f..04b6d3793d 100644 --- a/docker/services/haproxy.yaml +++ b/docker/services/haproxy.yaml @@ -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