mysql_user

Collection: community.general

Full Name: parallax.community.general.mysql_user

Aliases: community.general.mysql_user, mysql_user

Synopsis

Manage MySQL and MariaDB user accounts and privileges

Parameters

NameTypeRequiredDefaultDescription
namestringyesName of the MySQL user
passwordstringPassword for the user
hoststringlocalhostThe host part of the MySQL username
statestringpresentState of the user Choices: present, absent
privstringMySQL privileges string (e.g. db.*:ALL)
login_hoststringlocalhostHost running MySQL
login_portint3306Port of the MySQL server
login_userstringrootUser to authenticate with
login_passwordstringPassword for authentication
login_unix_socketstringPath to a Unix socket for local connections
encryptedboolfalseWhether the password is already encrypted
append_privsboolfalseAppend privileges instead of overwriting
check_implicit_adminboolfalseCheck if mysql allows login as root without password
update_passwordstringalwaysWhen to update the password Choices: always, on_create
pluginstringAuthentication plugin for the user
plugin_auth_stringstringAuthentication string for the plugin
plugin_hash_stringstringAuthentication hash for the plugin
resource_limitsstringResource limits for the user (JSON format)
tls_requiresstringTLS requirements for the user

Example

- name: Grant the application user access to its database
  mysql_user:
    name: app
    password: "{{ mysql_app_password }}"
    host: "10.0.%"
    priv: "appdb.*:ALL"
    state: present