ansible-redis
ansible-redis copied to clipboard
Role idempotency, lots of small changes
I guess this change is too large to be merged ... but nevertheless (and at least it might be of help for anyone who still hopes for a fix of https://github.com/DavidWittman/ansible-redis/issues/22):
It's based on https://github.com/DavidWittman/ansible-redis/pull/202, and https://github.com/DavidWittman/ansible-redis/pull/128 and may fix https://github.com/DavidWittman/ansible-redis/issues/22.
Configuration file management is done via lineinfileand the role of a node is dynamically updated, i.e. when a fail-over or switch-over has happened it will use the new values for replicaof and sentinel monitor options.
Btw. slave was changed to replica all over the place and as such Redis v5 might be the minimal supported version ...
I have tested these changes on Ubuntu 20.04 and Ansible 2.9.12 (so maybe min ansible version might need to be increased in meta/main.yml).
I have start to review your changes, thanks a lot for your work.
tasks/runtime_facts.ymlall shell calls needscheck_mode: no- I don't know if there is a way to handle
chdirin check mode when directory doesn't exists ( it through an error in check mode for now )
Great that you are reviewing the changes. I have added check_mode: no to those places and also tweaked some things in install.yml to support check mode.
I have done other tests.
- If I try to go from a non-replica setup to a replica state there is some check failing because of the missing of some scripts in
--checkmode but it's not easily fixable ( and I think it's safe to failing because I had deploy with an old version of the role ) - The
Runtime facts - (sentinel) get replicaoftask need some work, if you enable sentinel after had run the role previously it failed because the flagredis_is_runningis true but sentinel isn't running.
Thank you for further looking into the PR. Unfortunately I will most likely not be able to spend time on this in the foreseeable future. So if you would like to pick up where I left the PR, just go ahead. Otherwise I might get back to it someday.