Merge pull request #124 from banyek/mysql-gtid-replication

gtid_replication parameter added
This commit is contained in:
Brian Coca 2015-05-13 13:51:35 -04:00
commit 07ed2ffb67

View file

@ -109,7 +109,9 @@ options:
master_ssl_cipher: master_ssl_cipher:
description: description:
- same as mysql variable - same as mysql variable
master_auto_position:
descrtiption:
- does the host uses GTID based replication or not
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -242,6 +244,7 @@ def main():
login_port=dict(default=3306, type='int'), login_port=dict(default=3306, type='int'),
login_unix_socket=dict(default=None), login_unix_socket=dict(default=None),
mode=dict(default="getslave", choices=["getmaster", "getslave", "changemaster", "stopslave", "startslave"]), mode=dict(default="getslave", choices=["getmaster", "getslave", "changemaster", "stopslave", "startslave"]),
master_auto_position=dict(default=False, type='bool'),
master_host=dict(default=None), master_host=dict(default=None),
master_user=dict(default=None), master_user=dict(default=None),
master_password=dict(default=None), master_password=dict(default=None),
@ -279,6 +282,7 @@ def main():
master_ssl_cert = module.params["master_ssl_cert"] master_ssl_cert = module.params["master_ssl_cert"]
master_ssl_key = module.params["master_ssl_key"] master_ssl_key = module.params["master_ssl_key"]
master_ssl_cipher = module.params["master_ssl_cipher"] master_ssl_cipher = module.params["master_ssl_cipher"]
master_auto_position = module.params["master_auto_position"]
if not mysqldb_found: if not mysqldb_found:
module.fail_json(msg="the python mysqldb module is required") module.fail_json(msg="the python mysqldb module is required")
@ -376,6 +380,8 @@ def main():
if master_ssl_cipher: if master_ssl_cipher:
chm.append("MASTER_SSL_CIPHER=%(master_ssl_cipher)s") chm.append("MASTER_SSL_CIPHER=%(master_ssl_cipher)s")
chm_params['master_ssl_cipher'] = master_ssl_cipher chm_params['master_ssl_cipher'] = master_ssl_cipher
if master_auto_position:
chm.append("MASTER_AUTO_POSITION = 1")
changemaster(cursor, chm, chm_params) changemaster(cursor, chm, chm_params)
module.exit_json(changed=True) module.exit_json(changed=True)
elif mode in "startslave": elif mode in "startslave":