ansible-redis icon indicating copy to clipboard operation
ansible-redis copied to clipboard

Add replication role detection from runtime Redis information

Open danielkza opened this issue 8 years ago • 3 comments

Make the role aware of the runtime-assigned replication roles of existing Redis instances to avoid forcing role changes to instances (which might cause downtime).

Do it by sourcing data from the INFO Redis command through a fact script, then using that information to determine whether an already running instance is a master or a slave. Then, if the option is enabled, ignore the manually assigned role in favor of the detected role. That fact script can also possibly replace the existing redis one, which is really not that useful, since a) you likely already have the data it contains from the inventory b) it doesn't support/can't distinguish more than once instance.

~~Hopefully is enough to fix #22 without requiring any weird configuration generation.~~ Unfortunately that was too optimistic, it seems some weird stuff will be necessary.

Tests are pending - I'm posting this for some feedback before going further.

danielkza avatar Nov 16 '16 10:11 danielkza

@DavidWittman I did some work to try and solve the problems that #25 couldn't, by attempting to merge rewritten configuration with our managed config at daemon startup time, with some other assorted fixes. Please check it out if you can.

danielkza avatar Nov 24 '16 21:11 danielkza

I fixed systemd quoting issues (as #30) by rebasing some commits.

danielkza avatar Nov 25 '16 21:11 danielkza

It seems Ansible 1.9 doesn't support the systemd module :(

edit: scratch that, it's actually just in 2.2. I guess I need to call daemon-reload manually instead.

danielkza avatar Nov 25 '16 22:11 danielkza