Only include resource-agent tasks when pacemaker is running

This removes all the checks for a running pacemaker from the
resource-agent's tasks and puts that responsibility on the caller.
Effectively cleaning up the resource-agent.yml code.
This commit is contained in:
Juan Antonio Osorio Robles 2017-11-29 08:27:29 +00:00
parent 0f23845be3
commit d88d758f81
2 changed files with 3 additions and 8 deletions

View File

@ -69,4 +69,6 @@
loop_control:
loop_var: current_vip
with_items: "{{ networks|default([])|json_query('[*].vips[]')|list }}"
when: node_hosting_the_vip.stdout == ansible_hostname
when:
- node_hosting_the_vip.stdout == ansible_hostname
- pacemaker_running

View File

@ -14,36 +14,29 @@
command: pcs resource show {{ resource_agent_name }}
ignore_errors: yes
register: found_resource_agent
when:
- pacemaker_running
- name: Delete {{ resource_agent_name }} Resource Agent
command: pcs resource delete {{ resource_agent_name }}
when:
- pacemaker_running
- resource_agent.changed
- found_resource_agent|succeeded
- name: Add {{ resource_agent_name }} pacemaker resource agent
command: pcs resource create {{ resource_agent_name }} ocf:heartbeat:ipsec tunnel={{ specific_tunnel }} vip={{ specific_vip }} --disabled
when:
- pacemaker_running
- resource_agent.changed or found_resource_agent|failed
- name: Add collocation rule with VIP ( {{ resource_agent_name }} )
command: pcs constraint colocation add {{ resource_agent_name }} with ip-{{ specific_vip }}
when:
- pacemaker_running
- resource_agent.changed or found_resource_agent|failed
- name: Add ordering rule with VIP ( {{ resource_agent_name }} )
command: pcs constraint order start ip-{{ specific_vip }} then {{ resource_agent_name }}
when:
- pacemaker_running
- resource_agent.changed or found_resource_agent|failed
- name: Enable {{ resource_agent_name }} resource agent
command: pcs resource enable {{ resource_agent_name }}
when:
- pacemaker_running
- resource_agent.changed or found_resource_agent|failed