Tag: ansible

  • MySQL replication module upgrade

    Yesterday I put some new features into ansible’s mysql_replication module because we are planning to move to GTID-based replication from the good old binlog position based one, and the module wasn’t aware of GTIDs.

    gtid_replication

    This parameter can be either 0 or 1, defaults to 0. If set to 1 the replication will be treated as GTID-based replication.

    warnings_filtered

    This parameter threats the warnings because MySQL 5.6 complains a lot more than the previous versions. (For example, if the replication is not encrypted with SSL/TLS.) This could break our playbooks so you can set it to all, warnings, none (defaults none). Speaks for itself, all means all warnings/errors will be shown, if warnings set, then only the errors will be shown, and the warnings suppressed, and if none then that means, every message will show up as-is.

    If you need it, and you don’t want to wait until it is merged and released, you can download it from my GitHub repository.

  • MySQL variables module for ansible

    I’ve created another module for this besides mysql_replication, named mysql_variables.

    The purpose of this module is to get/set variables from running MySQL servers and avoid using the shell module for this, because that is a bit frustrating, and there are long commands to run.

    For example, when you wanna set read_only mode via shell, you can do that like this:

    (more…)

  • MySQL replication module for ansible

    We maintain a lot of servers under Kinja, so we have to use some orchestrator software to perform some tasks on a lot of servers. The Ansible software is used by us because it is cool.

    We also have a lot of MySQL servers (and counting!) under Kinja, so we have some tasks to perform on them, such as managing replication. Of course, there are some ways to do this, for example by using multiplexed terminals or running ansible shell commands that perform mysql queries (e.g. ansible mysql-master1 -m shell -a “mysql -e “SOME SQL QUERY HERE”) but it is not too comfy and needs a lot of manual work.

    So, there is a way to make it easier for us, and that’s why I made a mysql_replication module for Ansible. (And I made a pull request for that on GitHub, so I hope it will be merged into the ‘official’ branch soon.)

    The mysql_replication module helps you to

    • Query slave status
    • Query master status
    • Change the replication slave’s parameters (such as master server IP, master_log_pos, etc.)
    • Stop the slave thread
    • Start the slave thread

    The module can be found in my GitHub repo here.