ansible/ansible — pull request #588 by marktheunissen (2012-07-13 17:05:20+00:00)
Title: Mysql user module

This is ready for final review and merge into devel. I've implemented the fixes suggested on the previous pull request.

It handles only the MySQL users, another module will be coming that does databases.

##### mysql user

Administer MySQL users and privileges. Note that you may have to pass two user accounts,
one for the super-user whose credentials will be used to administer the server, and
another which will be the user to be created/deleted/modified. The super-user credentials
are prefixed by 'login', for example 'loginuser' and 'loginpass'.

user:

* Name of the MySQL user to create, delete or modify. Required.

host:

* MySQL users are always a combination of username and host, therefore this parameter
is also required.

state:

* Either 'present' or 'absent'. If 'absent', the MySQL user will be removed if it's
present. Defaults to 'present'.

passwd:

* The desired user password.

priv:

* The user privileges that will be applied to the new or existing user, if they
are different. The format of this is as follows:

db1.table:PRIVILEGE1,PRIVILEGE2/db2.table:PRIVILEGE1,PRIVILEGE2

loginuser:

* The user account that will be used to login to the MySQL server and perform the
operations. Needs to have appropriate privileges to administer users. Defaults
to 'root'.

loginpass:

* The password for the user that will be used to login to the server for administration
purposes. Required.

loginhost:

* The hostname of the MySQL server that this module will connect to. Defaults to
'localhost'.

Examples:

mysql loginpass=password user=jane passwd=123456 state=present
mysql loginpass=password user=harry state=absent
mysql loginpass=password user=mary passwd=123456 priv=*.*:ALL state=present
mysql loginpass=password user=jack passwd=123456 priv=clients.*:SELECT,UPDATE/invoices.*:ALL state=present