1919author:
2020- Balazs Pocze (@banyek)
2121- Andrew Klychkov (@Andersson007)
22+ - Jorge Rodriguez (@Jorge-Rodriguez)
2223options:
2324 mode:
2425 description:
4243 - resetreplica
4344 - resetreplicaall
4445 default: getreplica
46+ primary_bind:
47+ description:
48+ - Same as the C(MASTER_BIND) mysql variable.
49+ type: str
50+ version_added: 3.6.0
4551 primary_host:
4652 description:
4753 - Same as the C(MASTER_HOST) mysql variable.
6268 - Same as the C(MASTER_PORT) mysql variable.
6369 type: int
6470 aliases: [master_port]
71+ primary_heartbeat_period:
72+ description:
73+ - Same as the C(MASTER_HEARTBEAT_PERIOD) mysql variable.
74+ type: int
75+ version_added: 3.6.0
6576 primary_connect_retry:
6677 description:
6778 - Same as the C(MASTER_CONNECT_RETRY) mysql variable.
6879 type: int
6980 aliases: [master_connect_retry]
81+ primary_retry_count:
82+ description:
83+ - Same as the C(MASTER_RETRY_COUNT) mysql variable.
84+ type: int
85+ version_added: 3.6.0
7086 primary_log_file:
7187 description:
7288 - Same as the C(MASTER_LOG_FILE) mysql variable.
116132 L(MySQL encrypted replication documentation,https://dev.mysql.com/doc/refman/8.0/en/replication-solutions-encrypted-connections.html).
117133 type: str
118134 aliases: [master_ssl_cert]
135+ primary_ssl_crl:
136+ description:
137+ - Same as the C(MASTER_SSL_CRL) mysql variable.
138+ - For details, refer to
139+ L(MySQL encrypted replication documentation,https://dev.mysql.com/doc/refman/8.0/en/replication-solutions-encrypted-connections.html).
140+ type: str
141+ version_added: 3.6.0
142+ primary_ssl_crlpath:
143+ description:
144+ - Same as the C(MASTER_SSL_CRLPATH) mysql variable.
145+ - For details, refer to
146+ L(MySQL encrypted replication documentation,https://dev.mysql.com/doc/refman/8.0/en/replication-solutions-encrypted-connections.html).
147+ type: str
148+ version_added: 3.6.0
119149 primary_ssl_key:
120150 description:
121151 - Same as the C(MASTER_SSL_KEY) mysql variable.
133163 aliases: [master_ssl_cipher]
134164 primary_ssl_verify_server_cert:
135165 description:
136- - Same as mysql variable.
166+ - Same as the C(SOURCE_SSL_VERIFY_SERVER_CERT) mysql variable.
137167 type: bool
138168 default: false
139- version_added: '3.5.0'
169+ version_added: 3.5.0
170+ primary_tls_version:
171+ description:
172+ - Same as the C(MASTER_TLS_VERSION) mysql variable.
173+ type: str
174+ version_added: 3.6.0
140175 primary_auto_position:
141176 description:
142177 - Whether the host uses GTID based replication or not.
143178 - Same as the C(MASTER_AUTO_POSITION) mysql variable.
144179 type: bool
145180 default: false
146181 aliases: [master_auto_position]
182+ ignore_server_ids:
183+ description:
184+ - List of server IDs whose events are ignored.
185+ type: list
186+ elements: str
187+ version_added: 3.6.0
188+ do_domain_ids:
189+ description:
190+ - Same as MariaDB variable.
191+ type: list
192+ elements: str
193+ version_added: 3.6.0
194+ ignore_domain_ids:
195+ description:
196+ - Same as MariaDB variable.
197+ type: list
198+ elements: str
199+ version_added: 3.6.0
147200 primary_use_gtid:
148201 description:
149202 - Configures the replica to use the MariaDB Global Transaction ID.
164217 type: int
165218 version_added: '0.1.0'
166219 aliases: [master_delay]
220+ privilege_checks_user:
221+ description:
222+ - Same as mysql variable.
223+ choices: [account]
224+ type: str
225+ version_added: 3.6.0
226+ require_row_format:
227+ description:
228+ - Same as mysql variable.
229+ type: bool
230+ default: False
231+ version_added: 3.6.0
232+ require_table_primary_key_check:
233+ description:
234+ - Same as mysql variable.
235+ choices: ["stream", "on", "off"]
236+ type: str
237+ version_added: 3.6.0
238+ source_connection_auto_failover:
239+ description:
240+ - Same as mysql variable.
241+ type: bool
242+ default: False
243+ version_added: 3.6.0
244+ primary_compression_algorithms:
245+ description:
246+ - Same as the C(MASTER_COMPRESSION_ALGORITHMS) mysql variable.
247+ type: str
248+ version_added: 3.6.0
249+ primary_zstd_compression_level:
250+ description:
251+ - Same as the C(MASTER_ZSTD_COMPRESSION_LEVEL) mysql variable. Valid values are in the range [1-22]
252+ type: int
253+ choices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
254+ version_added: 3.6.0
255+ primary_tls_ciphersuites:
256+ description:
257+ - Same as the C(MASTER_TLS_CIPHERSUITES) mysql variable.
258+ type: str
259+ version_added: 3.6.0
260+ primary_public_key_path:
261+ description:
262+ - Same as the C(MASTER_PUBLIC_KEY_PATH) mysql variable.
263+ type: str
264+ version_added: 3.6.0
265+ get_primary_public_key:
266+ description:
267+ - Same as the C(GET_MASTER_PUBLIC_KEY) mysql variable.
268+ type: bool
269+ default: False
270+ version_added: 3.6.0
271+ network_namespace:
272+ description:
273+ - Same as mysql variable.
274+ type: str
275+ version_added: 3.6.0
167276 connection_name:
168277 description:
169278 - Name of the primary connection.
@@ -449,11 +558,14 @@ def main():
449558 'resetreplica' ,
450559 'resetreplicaall' ]),
451560 primary_auto_position = dict (type = 'bool' , default = False , aliases = ['master_auto_position' ]),
561+ primary_bind = dict (type = 'str' ),
452562 primary_host = dict (type = 'str' , aliases = ['master_host' ]),
453563 primary_user = dict (type = 'str' , aliases = ['master_user' ]),
454564 primary_password = dict (type = 'str' , no_log = True , aliases = ['master_password' ]),
455565 primary_port = dict (type = 'int' , aliases = ['master_port' ]),
566+ primary_heartbeat_period = dict (type = 'int' ),
456567 primary_connect_retry = dict (type = 'int' , aliases = ['master_connect_retry' ]),
568+ primary_retry_count = dict (type = 'int' ),
457569 primary_log_file = dict (type = 'str' , aliases = ['master_log_file' ]),
458570 primary_log_pos = dict (type = 'int' , aliases = ['master_log_pos' ]),
459571 relay_log_file = dict (type = 'str' ),
@@ -462,13 +574,29 @@ def main():
462574 primary_ssl_ca = dict (type = 'str' , aliases = ['master_ssl_ca' ]),
463575 primary_ssl_capath = dict (type = 'str' , aliases = ['master_ssl_capath' ]),
464576 primary_ssl_cert = dict (type = 'str' , aliases = ['master_ssl_cert' ]),
577+ primary_ssl_crl = dict (type = 'str' ),
578+ primary_ssl_crlpath = dict (type = 'str' ),
465579 primary_ssl_key = dict (type = 'str' , no_log = False , aliases = ['master_ssl_key' ]),
466580 primary_ssl_cipher = dict (type = 'str' , aliases = ['master_ssl_cipher' ]),
467581 primary_ssl_verify_server_cert = dict (type = 'bool' , default = False ),
582+ primary_tls_version = dict (type = 'str' ),
583+ primary_compression_algorithms = dict (type = 'str' ),
584+ primary_zstd_compression_level = dict (type = 'int' , choices = list (range (1 , 23 ))),
585+ primary_tls_ciphersuites = dict (type = 'str' ),
586+ primary_public_key_path = dict (type = 'str' ),
587+ get_primary_public_key = dict (type = 'bool' , default = False ),
468588 primary_use_gtid = dict (type = 'str' , choices = [
469589 'current_pos' , 'replica_pos' , 'disabled' ], aliases = ['master_use_gtid' ]),
590+ ignore_server_ids = dict (type = 'list' , elements = "str" ),
591+ do_domain_ids = dict (type = 'list' , elements = "str" ),
592+ ignore_domain_ids = dict (type = 'list' , elements = "str" ),
470593 primary_delay = dict (type = 'int' , aliases = ['master_delay' ]),
471594 connection_name = dict (type = 'str' ),
595+ privilege_checks_user = dict (type = 'str' , choices = ['account' ]),
596+ require_row_format = dict (type = 'bool' , default = False ),
597+ require_table_primary_key_check = dict (type = 'str' , choices = ['stream' , 'on' , 'off' ]),
598+ source_connection_auto_failover = dict (type = 'bool' , default = False ),
599+ network_namespace = dict (type = 'str' ),
472600 channel = dict (type = 'str' ),
473601 fail_on_error = dict (type = 'bool' , default = False ),
474602 )
@@ -479,11 +607,14 @@ def main():
479607 ],
480608 )
481609 mode = module .params ["mode" ]
610+ primary_bind = module .params ["primary_bind" ]
482611 primary_host = module .params ["primary_host" ]
483612 primary_user = module .params ["primary_user" ]
484613 primary_password = module .params ["primary_password" ]
485614 primary_port = module .params ["primary_port" ]
615+ primary_heartbeat_period = module .params ["primary_heartbeat_period" ]
486616 primary_connect_retry = module .params ["primary_connect_retry" ]
617+ primary_retry_count = module .params ["primary_retry_count" ]
487618 primary_log_file = module .params ["primary_log_file" ]
488619 primary_log_pos = module .params ["primary_log_pos" ]
489620 relay_log_file = module .params ["relay_log_file" ]
@@ -492,10 +623,26 @@ def main():
492623 primary_ssl_ca = module .params ["primary_ssl_ca" ]
493624 primary_ssl_capath = module .params ["primary_ssl_capath" ]
494625 primary_ssl_cert = module .params ["primary_ssl_cert" ]
626+ primary_ssl_crl = module .params ["primary_ssl_crl" ]
627+ primary_ssl_crlpath = module .params ["primary_ssl_crlpath" ]
495628 primary_ssl_key = module .params ["primary_ssl_key" ]
496629 primary_ssl_cipher = module .params ["primary_ssl_cipher" ]
497630 primary_ssl_verify_server_cert = module .params ["primary_ssl_verify_server_cert" ]
631+ primary_tls_version = module .params ["primary_tls_version" ]
632+ primary_compression_algorithms = module .params ["primary_compression_algorithms" ]
633+ primary_zstd_compression_level = module .params ["primary_zstd_compression_level" ]
634+ primary_tls_ciphersuites = module .params ["primary_tls_ciphersuites" ]
635+ primary_public_key_path = module .params ["primary_public_key_path" ]
636+ get_primary_public_key = module .params ["get_primary_public_key" ]
498637 primary_auto_position = module .params ["primary_auto_position" ]
638+ ignore_server_ids = module .params ["ignore_server_ids" ]
639+ do_domain_ids = module .params ["do_domain_ids" ]
640+ ignore_domain_ids = module .params ["ignore_domain_ids" ]
641+ privilege_checks_user = module .params ["privilege_checks_user" ]
642+ require_row_format = module .params ["require_row_format" ]
643+ require_table_primary_key_check = module .params ["require_table_primary_key_check" ]
644+ source_connection_auto_failover = module .params ["source_connection_auto_failover" ]
645+ network_namespace = module .params ["network_namespace" ]
499646 ssl_cert = module .params ["client_cert" ]
500647 ssl_key = module .params ["client_key" ]
501648 ssl_ca = module .params ["ca_cert" ]
@@ -568,6 +715,8 @@ def main():
568715 elif mode == 'changeprimary' :
569716 chm = []
570717 result = {}
718+ if primary_bind is not None :
719+ chm .append ("MASTER_BIND='%s'" % primary_bind )
571720 if primary_host is not None :
572721 chm .append ("MASTER_HOST='%s'" % primary_host )
573722 if primary_user is not None :
@@ -576,8 +725,12 @@ def main():
576725 chm .append ("MASTER_PASSWORD='%s'" % primary_password )
577726 if primary_port is not None :
578727 chm .append ("MASTER_PORT=%s" % primary_port )
728+ if primary_heartbeat_period is not None :
729+ chm .append ("MASTER_HEARTBEAT_PERIOD='%s'" % primary_heartbeat_period )
579730 if primary_connect_retry is not None :
580731 chm .append ("MASTER_CONNECT_RETRY=%s" % primary_connect_retry )
732+ if primary_retry_count is not None :
733+ chm .append ("MASTER_RETRY_COUNT='%s'" % primary_retry_count )
581734 if primary_log_file is not None :
582735 chm .append ("MASTER_LOG_FILE='%s'" % primary_log_file )
583736 if primary_log_pos is not None :
@@ -599,16 +752,48 @@ def main():
599752 chm .append ("MASTER_SSL_CAPATH='%s'" % primary_ssl_capath )
600753 if primary_ssl_cert is not None :
601754 chm .append ("MASTER_SSL_CERT='%s'" % primary_ssl_cert )
755+ if primary_ssl_crl is not None :
756+ chm .append ("MASTER_SSL_CRL='%s'" % primary_ssl_crl )
757+ if primary_ssl_crlpath is not None :
758+ chm .append ("MASTER_SSL_CRLPATH='%s'" % primary_ssl_crlpath )
602759 if primary_ssl_key is not None :
603760 chm .append ("MASTER_SSL_KEY='%s'" % primary_ssl_key )
604761 if primary_ssl_cipher is not None :
605762 chm .append ("MASTER_SSL_CIPHER='%s'" % primary_ssl_cipher )
763+ if primary_tls_version is not None :
764+ chm .append ("MASTER_TLS_VERSION='%s'" % primary_tls_version )
765+ if primary_compression_algorithms is not None :
766+ chm .append ("MASTER_COMPRESSION_ALGORITHMS='%s'" % primary_compression_algorithms )
767+ if primary_zstd_compression_level is not None :
768+ chm .append ("MASTER_ZSTD_COMPRESSION_LEVEL='%s'" % primary_zstd_compression_level )
769+ if primary_tls_ciphersuites is not None :
770+ chm .append ("MASTER_TLS_CIPHERSUITES='%s'" % primary_tls_ciphersuites )
771+ if primary_public_key_path is not None :
772+ chm .append ("MASTER_PUBLIC_KEY_PATH='%s'" % primary_public_key_path )
773+ if get_primary_public_key :
774+ chm .append ("GET_MASTER_PUBLIC_KEY=1" )
606775 if primary_ssl_verify_server_cert :
607776 chm .append ("SOURCE_SSL_VERIFY_SERVER_CERT=1" )
608777 if primary_auto_position :
609778 chm .append ("MASTER_AUTO_POSITION=1" )
610779 if primary_use_gtid is not None :
611780 chm .append ("MASTER_USE_GTID=%s" % primary_use_gtid )
781+ if ignore_server_ids :
782+ chm .append ("IGNORE_SERVER_IDS='%s'" % ',' .join (ignore_server_ids ))
783+ if do_domain_ids :
784+ chm .append ("DO_DOMAIN_IDS='%s'" % ',' .join (do_domain_ids ))
785+ if ignore_domain_ids :
786+ chm .append ("IGNORE_DOMAIN_IDS='%s'" % ',' .join (ignore_domain_ids ))
787+ if privilege_checks_user is not None :
788+ chm .append ("PRIVILEGE_CHECKS_USER='%s'" % privilege_checks_user )
789+ if require_row_format :
790+ chm .append ("REQUIRE_ROW_FORMAT=1" )
791+ if require_table_primary_key_check is not None :
792+ chm .append ("REQUIRE_TABLE_PRIMARY_KEY_CHECK='%s'" % require_table_primary_key_check )
793+ if source_connection_auto_failover :
794+ chm .append ("SOURCE_CONNECTION_AUTO_FAILOVER=1" )
795+ if network_namespace is not None :
796+ chm .append ("NETWORK_NAMESPACE='%s'" % network_namespace )
612797 try :
613798 changeprimary (cursor , chm , connection_name , channel )
614799 except mysql_driver .Warning as e :
0 commit comments