ansible / ansible.builtin / v2.3.3.0-1 / module / mysql_replication Manage MySQL replication | "added in version" 1.3 of ansible.builtin" Authors: Balazs Pocze (@banyek) preview | supported by communityansible.builtin.mysql_replication (v2.3.3.0-1) — module
pip
Install with pip install ansible==2.3.3.0.post1
Manages MySQL server replication, slave, master status get and change master host.
# Stop mysql slave thread - mysql_replication: mode: stopslave
# Get master binlog file name and binlog position - mysql_replication: mode: getmaster
# Change master to master server 192.0.2.1 and use binary log 'mysql-bin.000009' with position 4578 - mysql_replication: mode: changemaster master_host: 192.0.2.1 master_log_file: mysql-bin.000009 master_log_pos: 4578
# Check slave status using port 3308 - mysql_replication: mode: getslave login_host: ansible.example.com login_port: 3308
mode: choices: - getslave - getmaster - changemaster - stopslave - startslave - resetslave - resetslaveall default: getslave description: - module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave (START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL) required: false ca_cert: aliases: - ssl_ca description: - The path to a Certificate Authority (CA) certificate. This option, if used, must specify the same certificate as used by the server. type: path client_key: aliases: - ssl_key description: - The path to the client private key. type: path login_host: default: localhost description: - Host running the database. - In some cases for local connections the I(login_unix_socket=/path/to/mysqld/socket), that is usually C(/var/run/mysqld/mysqld.sock), needs to be used instead of I(login_host=localhost). type: str login_port: default: 3306 description: - Port of the MySQL server. Requires I(login_host) be defined as other than localhost if login_port is used. type: int login_user: description: - The username used to authenticate with. type: str master_ssl: choices: - 0 - 1 description: - same as mysql variable client_cert: aliases: - ssl_cert description: - The path to a client public key certificate. type: path config_file: default: ~/.my.cnf description: - Specify a config file from which user and password are to be read. type: path master_host: description: - same as mysql variable master_port: description: - same as mysql variable master_user: description: - same as mysql variable master_ssl_ca: description: - same as mysql variable relay_log_pos: description: - same as mysql variable check_hostname: description: - Whether to validate the server host name when an SSL connection is required. - Setting this to C(false) disables hostname verification. Use with caution. - Requires pymysql >= 0.7.11. - This optoin has no effect on MySQLdb. type: bool version_added: 1.1.0 version_added_collection: community.mysql login_password: description: - The password used to authenticate with. type: str master_log_pos: description: - same as mysql variable master_ssl_key: description: - same as mysql variable relay_log_file: description: - same as mysql variable connect_timeout: default: 30 description: - The connection timeout when connecting to the MySQL server. type: int master_log_file: description: - same as mysql variable master_password: description: - same as mysql variable master_ssl_cert: description: - same as mysql variable login_unix_socket: description: - The path to a Unix domain socket for local connections. type: str master_ssl_capath: description: - same as mysql variable master_ssl_cipher: description: - same as mysql variable master_auto_position: default: null description: - does the host uses GTID based replication or not required: false version_added: '2.0' version_added_collection: ansible.builtin master_connect_retry: description: - same as mysql variable