ANSIBLE.MYSQL_USER(3)           ANSIBLE MODULES          ANSIBLE.MYSQL_USER(3)



NAME
       mysql_user - Adds or removes a user from a MySQL database.

DESCRIPTION
       Adds or removes a user from a MySQL database.

OPTIONS
       append_privs
              Append the privileges defined by priv to the existing ones for
              this user instead of overwriting existing ones.  Choices:
              yes,no. (default: no)(Added in Ansible version 1.4.)


       check_implicit_admin
              Check if mysql allows login as root/nopassword before trying
              supplied credentials.(Added in Ansible version 1.3.)


       host   the 'host' part of the MySQL username (default: localhost)

       login_host
              Host running the database (default: localhost)

       login_password
              The password used to authenticate with

       login_port
              Port of the MySQL server (default: 3306)(Added in Ansible
              version 1.4.)


       login_unix_socket
              The path to a Unix domain socket for local connections

       login_user
              The username used to authenticate with

       name   name of the user (role) to add or remove(required)

       password
              set the user's password

       priv   MySQL privileges string in the format: db.table:priv1,priv2

       state  Whether the user should exist.  When absent, removes the user.
              Choices: present,absent. (default: present).

NOTES
       Requires the MySQLdb Python package on the remote host. For Ubuntu,
       this is as easy as apt-get install python-mysqldb.

       Both login_password and login_username are required when you are
       passing credentials. If none are present, the module will attempt to
       read the credentials from ~/.my.cnf, and finally fall back to using the
       MySQL default login of 'root' with no password.

       MySQL server installs with default login_user of 'root' and no
       password. To secure this user as part of an idempotent playbook, you
       must create at least two tasks: the first must change the root user's
       password, without providing any login_user/login_password details. The
       second must drop a ~/.my.cnf file containing the new root credentials.
       Subsequent runs of the playbook will then succeed by reading the new
       credentials from the file.

EXAMPLES
       # Create database user with name 'bob' and password '12345' with all database privileges
       - mysql_user: name=bob password=12345 priv=*.*:ALL state=present

       # Ensure no user named 'sally' exists, also passing in the auth credentials.
       - mysql_user: login_user=root login_password=123456 name=sally state=absent

       # Example privileges string format
       mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL

       # Example using login_unix_socket to connect to server
       - mysql_user: name=root password=abc123 login_unix_socket=/var/run/mysqld/mysqld.sock

       # Example .my.cnf file for setting the root password
       # Note: don't use quotes around the password, because the mysql_user module
       # will include them in the password but the mysql client will not

       [client]
       user=root
       password=n<_665{vS43y



AUTHOR
       Mark Theunissen

SEE ALSO
       ansible(1), http://ansible.github.com/modules.html#mysql-user



1.4.5                             2014-02-12             ANSIBLE.MYSQL_USER(3)
