{"id":11,"date":"2013-06-19T00:21:23","date_gmt":"2013-06-18T23:21:23","guid":{"rendered":"http:\/\/188.166.119.205\/?p=11"},"modified":"2026-11-10T05:52:05","modified_gmt":"2026-11-10T05:52:05","slug":"mysql-replication-module-for-ansible","status":"publish","type":"post","link":"https:\/\/banyek.net\/?p=11&lang=en","title":{"rendered":"MySQL replication module for ansible"},"content":{"rendered":"<p>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 <a href=\"http:\/\/www.ansibleworks.com\/\">Ansible<\/a> software is used by us because it is cool.<\/p>\n<p>We have also 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 using multiplexed terminals, or run ansible shell commands what performs mysql queries (e.g. ansible mysql-master1 -m shell -a \u201cmysql -e \u201cSOME SQL QUERY HERE\u201d) but it is not too comfy, and needs a lot of manual work.<\/p>\n<p>So, there is a way to make it easier for us, and that\u2019s 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 soon to \u2018official\u2019 branch)<\/p>\n<p>The mysql_replication module helps you to<\/p>\n<ul>\n<li>Query slave status<\/li>\n<li>Query master status<\/li>\n<li>Change replication slave\u2019s parameters (such as master server IP, master_log_pos, etc.)<\/li>\n<li>Stop slave thread<\/li>\n<li>Start slave thread<\/li>\n<\/ul>\n<p>The module can be found in my GitHub repo <a href=\"https:\/\/github.com\/banyek\/ansible\/blob\/mysql_replication\/library\/database\/mysql_replication\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 have also a lot of MySQL servers (and counting!) under Kinja, so we have some tasks to perform [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[134],"tags":[228,150,144,126],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-tech-en","tag-ansible-en","tag-devops-en","tag-mysql-en","tag-oldblog-en"],"_links":{"self":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11"}],"version-history":[{"count":1,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":449,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/11\/revisions\/449"}],"wp:attachment":[{"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}