I'm trying to build a procedure that will allow me to add instances (servers and clients) to the cluster as we go along. I've noticed that if I start with a single machine and configured as both client and server, when I add another such server, one of them declares itself as the leader while the other one gets stuck in a "no leader" loop.
Steps to reproduce
Run the role with only one machine and configure its role to "both"
Edit the inventory file and add a second machine also role is also "both"
Expected Result
The two instances agree on a leader and the cluster is fully fucntional
Actual Result
One instance declares itself as the leader while the other one is stuck in a "no leader" loop.
Investigation
I've found that the root cause of this issue is the duplicate restart of the service. When a new machine is added, it is started twice. First in the main task when enabling the service and then it gets restarted in the handler becuase its configuration has changed.
Proposed solution
Only enable the service in the main task and let the handler start it.
I have working solution for systemd based systems which keeps other systems unchanged. I can open a PR for it
Info
I'm trying to build a procedure that will allow me to add instances (servers and clients) to the cluster as we go along. I've noticed that if I start with a single machine and configured as both client and server, when I add another such server, one of them declares itself as the leader while the other one gets stuck in a "no leader" loop.
Steps to reproduce
Expected Result
The two instances agree on a leader and the cluster is fully fucntional
Actual Result
One instance declares itself as the leader while the other one is stuck in a "no leader" loop.
Investigation
I've found that the root cause of this issue is the duplicate restart of the service. When a new machine is added, it is started twice. First in the main task when enabling the service and then it gets restarted in the handler becuase its configuration has changed.
Proposed solution
Only enable the service in the main task and let the handler start it.
I have working solution for systemd based systems which keeps other systems unchanged. I can open a PR for it