The [[ https://phabricator.wikimedia.org/diffusion/OSMD/browse/master/wmfmariadbpy/switchover.py | master switchover script ]] worked nicely for T197073, but it needs some extra features:
* Have it fully documented on wikitech so it can be used by any op
* have a dry-run feature where it goes over each step, but doesn't really change anything
* Provide timestamps for each step executed
* More pre-flight checks such as
** is pt-heartbeat running on the current master?
* Make heartbeat migration more robust until it is migrated to a systemd service or moved remotely (so it is automatic and etcd-dependent)
* It alters or checks some master-related variables automatically (pt-config-diff h=localhost /etc/my.cnf ?):
** Alter expire_log_days variable
** Alter gtid mode automatically
** Alter semi-sync automatically