Add pacemaker agent removal to uninstall process

Previsouly the uninstall process would just delete the tunnels, but
the resource agents would be left lingering there. This fixes that
by enabling the removal of these.

Change-Id: I2e3cc3aac6a5e4627f6b65ccf9c9fea7f196859f
Closes-Bug: #1751262
This commit is contained in:
Juan Antonio Osorio Robles 2018-03-15 11:45:54 +00:00
parent 61eac5e734
commit 7a98f669fe
5 changed files with 27 additions and 18 deletions

View File

@ -26,15 +26,6 @@
line: "\tuniqueids=no"
when: not use_opportunistic_ipsec|bool
- name: Get pacemaker status
systemd:
name: pacemaker
register: pacemaker_status
- name: Determine if pacemaker is running
set_fact:
pacemaker_running: "{{ pacemaker_status.status.ActiveState == 'active' }}"
# Permissions gotten from http://www.linux-ha.org/doc/dev-guides/_installing_and_packaging_resource_agents.html
- name: Install TripleO IPSEC resource agent
copy:

View File

@ -21,15 +21,6 @@
# ip: <Another actual VIP>
- import_tasks: hardcoded-network-discover.yml
- name: Get pacemaker status
systemd:
name: pacemaker
register: pacemaker_status
- name: Determine if pacemaker is running
set_fact:
pacemaker_running: "{{ pacemaker_status.status.ActiveState == 'active' }}"
# This returns the hostname (short) of the node hosting the VIP
- name: Determine which node is hosting the VIP
shell: pcs status | grep ip- | sed 's/ip-//' | awk '{print $1"\t"$4}' | grep "{{ networks[0]['vips'][0]['ip'] }}" | awk '{print $2}'

View File

@ -1,4 +1,6 @@
---
- import_tasks: pacemaker_facts.yml
- when: ipsec_uninstall_tunnels|bool or ipsec_upgrade_tunnels|bool
block:
- import_tasks: uninstall.yml

11
tasks/pacemaker_facts.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Get pacemaker status
systemd:
name: pacemaker
register: pacemaker_status
- name: Determine if pacemaker is running
set_fact:
pacemaker_running: "{{ pacemaker_status.status.ActiveState == 'active' }}"

View File

@ -1,4 +1,18 @@
---
- name: Get first node running the IPSec resource agents
shell: "pcs status | grep tripleo-ipsec | head -1 | awk '{print $4}'"
register: node_running_ipsec_agent_register
when: pacemaker_running|bool
changed_when: false
ignore_errors: true
- name: Delete IPSec pacemaker resource agents
shell: "pcs status | grep tripleo-ipsec | awk '{print $1}' | xargs -n1 pcs resource delete"
when:
- pacemaker_running|bool
- node_running_ipsec_agent_register.rc == 0
- node_running_ipsec_agent_register.stdout == ansible_hostname
- name: Find tunnel configurations to delete
find:
paths: /etc/ipsec.d/