Only install resource agent if pacemaker is running

There is no use in installing it when pacemaker isn't running, as
this will only be used in the controllers.
This commit is contained in:
Juan Antonio Osorio Robles 2017-11-29 08:25:16 +00:00
parent ea8ba7b8c5
commit 0f23845be3
3 changed files with 11 additions and 10 deletions

View File

@ -18,16 +18,6 @@
set_fact:
current_ip: "{{ hostvars[inventory_hostname][ip_var_key] }}"
- 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 effectively skips the configuration if we're in a network that's
# not actually enabled. We can notice that if the IP has fallen back to
# the control plane's IP.

View File

@ -28,6 +28,15 @@
notify:
- Restart ipsec
- 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:
@ -36,6 +45,7 @@
mode: '0755'
force: no
register: resource_agent
when: pacemaker_running
- include: ipsec-conf.yml
with_items: "{{ private_networks }}"

View File

@ -61,6 +61,7 @@
mode: '0755'
force: no
register: resource_agent
when: pacemaker_running
# This queries the VIPs for all networks and flattens them into a list
# that contains a dict with the "name" and "ip" for each VIP entry.