How to make Pacemaker stop resources to be removed

ansiblecrmpacemaker

I'm trying to create an Ansible Pacemaker role that creates the CIB configuration and then pushes it. The problem is: Pacemaker refuses to destroy a resource if it is not stopped.

I'm trying then to figure out how to properly stop all the resources before restarting them (or destroy them, or shutdown the cluster, doesn't matter if the new CIB is pushed immediately after).

The best would have been to force destroy unused resources, but I can't figure out how crmsh can perform that.

Have you an idea ? Thanks!

Best Answer

There is a playbook to "Stop Pacemaker resources matching the given prefix string" published on https://github.com/larsks/osp-6-7-ansible/blob/master/playbooks/roles/pcs-stop-prefix/tasks/main.yml

Inspecting the source, it calls command: pcs resource disable {{item}} then it waits until resource becomes stopped by periodically parsing pcs status xml. The latter may be crucial in your case.