19
19
author:
20
20
- Balazs Pocze (@banyek)
21
21
- Andrew Klychkov (@Andersson007)
22
+ - Jorge Rodriguez (@Jorge-Rodriguez)
22
23
options:
23
24
mode:
24
25
description:
42
43
- resetreplica
43
44
- resetreplicaall
44
45
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
45
51
primary_host:
46
52
description:
47
53
- Same as the C(MASTER_HOST) mysql variable.
62
68
- Same as the C(MASTER_PORT) mysql variable.
63
69
type: int
64
70
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
65
76
primary_connect_retry:
66
77
description:
67
78
- Same as the C(MASTER_CONNECT_RETRY) mysql variable.
68
79
type: int
69
80
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
70
86
primary_log_file:
71
87
description:
72
88
- Same as the C(MASTER_LOG_FILE) mysql variable.
116
132
L(MySQL encrypted replication documentation,https://dev.mysql.com/doc/refman/8.0/en/replication-solutions-encrypted-connections.html).
117
133
type: str
118
134
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
119
149
primary_ssl_key:
120
150
description:
121
151
- Same as the C(MASTER_SSL_KEY) mysql variable.
133
163
aliases: [master_ssl_cipher]
134
164
primary_ssl_verify_server_cert:
135
165
description:
136
- - Same as mysql variable.
166
+ - Same as the C(SOURCE_SSL_VERIFY_SERVER_CERT) mysql variable.
137
167
type: bool
138
168
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
140
175
primary_auto_position:
141
176
description:
142
177
- Whether the host uses GTID based replication or not.
143
178
- Same as the C(MASTER_AUTO_POSITION) mysql variable.
144
179
type: bool
145
180
default: false
146
181
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
147
200
primary_use_gtid:
148
201
description:
149
202
- Configures the replica to use the MariaDB Global Transaction ID.
164
217
type: int
165
218
version_added: '0.1.0'
166
219
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
167
276
connection_name:
168
277
description:
169
278
- Name of the primary connection.
@@ -449,11 +558,14 @@ def main():
449
558
'resetreplica' ,
450
559
'resetreplicaall' ]),
451
560
primary_auto_position = dict (type = 'bool' , default = False , aliases = ['master_auto_position' ]),
561
+ primary_bind = dict (type = 'str' ),
452
562
primary_host = dict (type = 'str' , aliases = ['master_host' ]),
453
563
primary_user = dict (type = 'str' , aliases = ['master_user' ]),
454
564
primary_password = dict (type = 'str' , no_log = True , aliases = ['master_password' ]),
455
565
primary_port = dict (type = 'int' , aliases = ['master_port' ]),
566
+ primary_heartbeat_period = dict (type = 'int' ),
456
567
primary_connect_retry = dict (type = 'int' , aliases = ['master_connect_retry' ]),
568
+ primary_retry_count = dict (type = 'int' ),
457
569
primary_log_file = dict (type = 'str' , aliases = ['master_log_file' ]),
458
570
primary_log_pos = dict (type = 'int' , aliases = ['master_log_pos' ]),
459
571
relay_log_file = dict (type = 'str' ),
@@ -462,13 +574,29 @@ def main():
462
574
primary_ssl_ca = dict (type = 'str' , aliases = ['master_ssl_ca' ]),
463
575
primary_ssl_capath = dict (type = 'str' , aliases = ['master_ssl_capath' ]),
464
576
primary_ssl_cert = dict (type = 'str' , aliases = ['master_ssl_cert' ]),
577
+ primary_ssl_crl = dict (type = 'str' ),
578
+ primary_ssl_crlpath = dict (type = 'str' ),
465
579
primary_ssl_key = dict (type = 'str' , no_log = False , aliases = ['master_ssl_key' ]),
466
580
primary_ssl_cipher = dict (type = 'str' , aliases = ['master_ssl_cipher' ]),
467
581
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 ),
468
588
primary_use_gtid = dict (type = 'str' , choices = [
469
589
'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" ),
470
593
primary_delay = dict (type = 'int' , aliases = ['master_delay' ]),
471
594
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' ),
472
600
channel = dict (type = 'str' ),
473
601
fail_on_error = dict (type = 'bool' , default = False ),
474
602
)
@@ -479,11 +607,14 @@ def main():
479
607
],
480
608
)
481
609
mode = module .params ["mode" ]
610
+ primary_bind = module .params ["primary_bind" ]
482
611
primary_host = module .params ["primary_host" ]
483
612
primary_user = module .params ["primary_user" ]
484
613
primary_password = module .params ["primary_password" ]
485
614
primary_port = module .params ["primary_port" ]
615
+ primary_heartbeat_period = module .params ["primary_heartbeat_period" ]
486
616
primary_connect_retry = module .params ["primary_connect_retry" ]
617
+ primary_retry_count = module .params ["primary_retry_count" ]
487
618
primary_log_file = module .params ["primary_log_file" ]
488
619
primary_log_pos = module .params ["primary_log_pos" ]
489
620
relay_log_file = module .params ["relay_log_file" ]
@@ -492,10 +623,26 @@ def main():
492
623
primary_ssl_ca = module .params ["primary_ssl_ca" ]
493
624
primary_ssl_capath = module .params ["primary_ssl_capath" ]
494
625
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" ]
495
628
primary_ssl_key = module .params ["primary_ssl_key" ]
496
629
primary_ssl_cipher = module .params ["primary_ssl_cipher" ]
497
630
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" ]
498
637
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" ]
499
646
ssl_cert = module .params ["client_cert" ]
500
647
ssl_key = module .params ["client_key" ]
501
648
ssl_ca = module .params ["ca_cert" ]
@@ -568,6 +715,8 @@ def main():
568
715
elif mode == 'changeprimary' :
569
716
chm = []
570
717
result = {}
718
+ if primary_bind is not None :
719
+ chm .append ("MASTER_BIND='%s'" % primary_bind )
571
720
if primary_host is not None :
572
721
chm .append ("MASTER_HOST='%s'" % primary_host )
573
722
if primary_user is not None :
@@ -576,8 +725,12 @@ def main():
576
725
chm .append ("MASTER_PASSWORD='%s'" % primary_password )
577
726
if primary_port is not None :
578
727
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 )
579
730
if primary_connect_retry is not None :
580
731
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 )
581
734
if primary_log_file is not None :
582
735
chm .append ("MASTER_LOG_FILE='%s'" % primary_log_file )
583
736
if primary_log_pos is not None :
@@ -599,16 +752,48 @@ def main():
599
752
chm .append ("MASTER_SSL_CAPATH='%s'" % primary_ssl_capath )
600
753
if primary_ssl_cert is not None :
601
754
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 )
602
759
if primary_ssl_key is not None :
603
760
chm .append ("MASTER_SSL_KEY='%s'" % primary_ssl_key )
604
761
if primary_ssl_cipher is not None :
605
762
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" )
606
775
if primary_ssl_verify_server_cert :
607
776
chm .append ("SOURCE_SSL_VERIFY_SERVER_CERT=1" )
608
777
if primary_auto_position :
609
778
chm .append ("MASTER_AUTO_POSITION=1" )
610
779
if primary_use_gtid is not None :
611
780
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 )
612
797
try :
613
798
changeprimary (cursor , chm , connection_name , channel )
614
799
except mysql_driver .Warning as e :
0 commit comments