community / community.general / 0.2.1 / module / mysql_variables Manage MySQL global variables Authors: Balazs Pocze (@banyek)community.general.mysql_variables (0.2.1) — module
Install with ansible-galaxy collection install community.general:==0.2.1
collections: - name: community.general version: 0.2.1
Query / Set MySQL variables.
- name: Check for sync_binlog setting mysql_variables: variable: sync_binlog
- name: Set read_only variable to 1 persistently mysql_variables: variable: read_only value: 1 mode: persist
mode: choices: - global - persist - persist_only default: global description: - C(global) assigns C(value) to a global system variable which will be changed at runtime but won't persist across server restarts. - C(persist) assigns C(value) to a global system variable and persists it to the mysqld-auto.cnf option file in the data directory (the variable will survive service restarts). - C(persist_only) persists C(value) to the mysqld-auto.cnf option file in the data directory but without setting the global variable runtime value (the value will be changed after the next service restart). - Supported by MySQL 8.0 or later. - For more information see U(https://dev.mysql.com/doc/refman/8.0/en/set-variable.html). type: str version_added: 0.2.0 version_added_collection: community.general value: description: - If set, then sets variable value to this type: str 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 variable: description: - Variable name to operate required: true type: str 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 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 login_password: description: - The password used to authenticate with. type: str connect_timeout: default: 30 description: - The connection timeout when connecting to the MySQL server. type: int login_unix_socket: description: - The path to a Unix domain socket for local connections. type: str
queries: description: List of executed queries which modified DB's state. returned: if executed sample: - SET GLOBAL `read_only` = 1 type: list version_added: 0.2.0 version_added_collection: community.general