|
|
@ -2,6 +2,7 @@
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
# Copyright: (c) 2013, Balazs Pocze <banyek@gawker.com>
|
|
|
|
# Copyright: (c) 2013, Balazs Pocze <banyek@gawker.com>
|
|
|
|
|
|
|
|
# Copyright: (c) 2019, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
|
|
|
|
# Certain parts are taken from Mark Theunissen's mysqldb module
|
|
|
|
# Certain parts are taken from Mark Theunissen's mysqldb module
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
|
|
|
@ -19,22 +20,29 @@ DOCUMENTATION = r'''
|
|
|
|
module: mysql_replication
|
|
|
|
module: mysql_replication
|
|
|
|
short_description: Manage MySQL replication
|
|
|
|
short_description: Manage MySQL replication
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Manages MySQL server replication, slave, master status get and change master host.
|
|
|
|
- Manages MySQL server replication, slave, master status, get and change master host.
|
|
|
|
version_added: "1.3"
|
|
|
|
version_added: '1.3'
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- Balazs Pocze (@banyek)
|
|
|
|
- Balazs Pocze (@banyek)
|
|
|
|
|
|
|
|
- Andrew Klychkov (@Andersson007)
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
mode:
|
|
|
|
mode:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave
|
|
|
|
- Module operating mode. Could be
|
|
|
|
(START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL)
|
|
|
|
C(changemaster) (CHANGE MASTER TO),
|
|
|
|
|
|
|
|
C(getmaster) (SHOW MASTER STATUS),
|
|
|
|
|
|
|
|
C(getslave) (SHOW SLAVE STATUS),
|
|
|
|
|
|
|
|
C(startslave) (START SLAVE),
|
|
|
|
|
|
|
|
C(stopslave) (STOP SLAVE),
|
|
|
|
|
|
|
|
C(resetslave) (RESET SLAVE),
|
|
|
|
|
|
|
|
C(resetslaveall) (RESET SLAVE ALL).
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
choices:
|
|
|
|
choices:
|
|
|
|
- getslave
|
|
|
|
|
|
|
|
- getmaster
|
|
|
|
|
|
|
|
- changemaster
|
|
|
|
- changemaster
|
|
|
|
- stopslave
|
|
|
|
- getmaster
|
|
|
|
|
|
|
|
- getslave
|
|
|
|
- startslave
|
|
|
|
- startslave
|
|
|
|
|
|
|
|
- stopslave
|
|
|
|
- resetslave
|
|
|
|
- resetslave
|
|
|
|
- resetslaveall
|
|
|
|
- resetslaveall
|
|
|
|
default: getslave
|
|
|
|
default: getslave
|
|
|
@ -102,7 +110,7 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Whether the host uses GTID based replication or not.
|
|
|
|
- Whether the host uses GTID based replication or not.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: '2.0'
|
|
|
|
master_use_gtid:
|
|
|
|
master_use_gtid:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Configures the slave to use the MariaDB Global Transaction ID.
|
|
|
|
- Configures the slave to use the MariaDB Global Transaction ID.
|
|
|
@ -112,31 +120,42 @@ options:
|
|
|
|
- Available since MariaDB 10.0.2.
|
|
|
|
- Available since MariaDB 10.0.2.
|
|
|
|
choices: [current_pos, slave_pos, disabled]
|
|
|
|
choices: [current_pos, slave_pos, disabled]
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
version_added: "2.10"
|
|
|
|
version_added: '2.10'
|
|
|
|
master_delay:
|
|
|
|
master_delay:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Time lag behind the master's state (in seconds).
|
|
|
|
- Time lag behind the master's state (in seconds).
|
|
|
|
- Available from MySQL 5.6.
|
|
|
|
- Available from MySQL 5.6.
|
|
|
|
- For more information see U(https://dev.mysql.com/doc/refman/8.0/en/replication-delayed.html).
|
|
|
|
- For more information see U(https://dev.mysql.com/doc/refman/8.0/en/replication-delayed.html).
|
|
|
|
type: int
|
|
|
|
type: int
|
|
|
|
version_added: "2.10"
|
|
|
|
version_added: '2.10'
|
|
|
|
connection_name:
|
|
|
|
connection_name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of the master connection.
|
|
|
|
- Name of the master connection.
|
|
|
|
- Supported from MariaDB 10.0.1.
|
|
|
|
- Supported from MariaDB 10.0.1.
|
|
|
|
|
|
|
|
- Mutually exclusive with I(channel).
|
|
|
|
- For more information see U(https://mariadb.com/kb/en/library/multi-source-replication/).
|
|
|
|
- For more information see U(https://mariadb.com/kb/en/library/multi-source-replication/).
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
version_added: "2.10"
|
|
|
|
version_added: '2.10'
|
|
|
|
channel:
|
|
|
|
channel:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of replication channel.
|
|
|
|
- Name of replication channel.
|
|
|
|
- Multi-source replication is supported from MySQL 5.7.
|
|
|
|
- Multi-source replication is supported from MySQL 5.7.
|
|
|
|
|
|
|
|
- Mutually exclusive with I(connection_name).
|
|
|
|
- For more information see U(https://dev.mysql.com/doc/refman/8.0/en/replication-multi-source.html).
|
|
|
|
- For more information see U(https://dev.mysql.com/doc/refman/8.0/en/replication-multi-source.html).
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
version_added: "2.10"
|
|
|
|
version_added: '2.10'
|
|
|
|
|
|
|
|
|
|
|
|
extends_documentation_fragment:
|
|
|
|
extends_documentation_fragment:
|
|
|
|
- mysql
|
|
|
|
- mysql
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seealso:
|
|
|
|
|
|
|
|
- module: mysql_info
|
|
|
|
|
|
|
|
- name: MySQL replication reference
|
|
|
|
|
|
|
|
description: Complete reference of the MySQL replication documentation.
|
|
|
|
|
|
|
|
link: https://dev.mysql.com/doc/refman/8.0/en/replication.html
|
|
|
|
|
|
|
|
- name: MariaDB replication reference
|
|
|
|
|
|
|
|
description: Complete reference of the MariaDB replication documentation.
|
|
|
|
|
|
|
|
link: https://mariadb.com/kb/en/library/setting-up-replication/
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
EXAMPLES = r'''
|
|
|
@ -342,7 +361,10 @@ def main():
|
|
|
|
master_delay=dict(type='int'),
|
|
|
|
master_delay=dict(type='int'),
|
|
|
|
connection_name=dict(type='str'),
|
|
|
|
connection_name=dict(type='str'),
|
|
|
|
channel=dict(type='str'),
|
|
|
|
channel=dict(type='str'),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
mutually_exclusive=[
|
|
|
|
|
|
|
|
['connection_name', 'channel']
|
|
|
|
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
mode = module.params["mode"]
|
|
|
|
mode = module.params["mode"]
|
|
|
|
master_host = module.params["master_host"]
|
|
|
|
master_host = module.params["master_host"]
|
|
|
|