From fca06a1dfb38dcd78b6d2528a1628fc330b91828 Mon Sep 17 00:00:00 2001 From: Balazs Pocze Date: Mon, 1 Dec 2014 15:16:40 +0100 Subject: [PATCH] gtid_replication parameter added to keep this module working in environments which are using GTID replication --- .../modules/extras/database/mysql/mysql_replication.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/database/mysql/mysql_replication.py b/lib/ansible/modules/extras/database/mysql/mysql_replication.py index 30811cdc924..799ef78e55f 100644 --- a/lib/ansible/modules/extras/database/mysql/mysql_replication.py +++ b/lib/ansible/modules/extras/database/mysql/mysql_replication.py @@ -109,7 +109,10 @@ options: master_ssl_cipher: description: - same as mysql variable - + gtid_replication: + descrtiption: + - does the host uses GTID based replication or not + possible values: 0,1 ''' EXAMPLES = ''' @@ -242,6 +245,7 @@ def main(): login_port=dict(default=3306, type='int'), login_unix_socket=dict(default=None), mode=dict(default="getslave", choices=["getmaster", "getslave", "changemaster", "stopslave", "startslave"]), + gtid_replication=dict(default=None, choices=['0', '1']), master_host=dict(default=None), master_user=dict(default=None), master_password=dict(default=None), @@ -279,6 +283,7 @@ def main(): master_ssl_cert = module.params["master_ssl_cert"] master_ssl_key = module.params["master_ssl_key"] master_ssl_cipher = module.params["master_ssl_cipher"] + gtid_replication = module.params["gtid_replication"] if not mysqldb_found: module.fail_json(msg="the python mysqldb module is required") @@ -376,6 +381,8 @@ def main(): if master_ssl_cipher: chm.append("MASTER_SSL_CIPHER=%(master_ssl_cipher)s") chm_params['master_ssl_cipher'] = master_ssl_cipher + if gtid_replication: + chm.append("MASTER_AUTO_POSITION = 1") changemaster(cursor, chm, chm_params) module.exit_json(changed=True) elif mode in "startslave":