ansible/ansible — pull request #590 by marktheunissen (2012-07-13 22:10:04+00:00)
Title: The MySQL modules

I've added an example YML playbook and these are the two mysql modules.

### 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. Defaults to 'localhost'.

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_user loginpass=password user=jane passwd=123456 state=present
mysql_user loginpass=password user=harry state=absent
mysql_user loginpass=password user=mary passwd=123456 priv=*.*:ALL state=present
mysql_user loginpass=password user=jack passwd=123456 priv=clients.*:SELECT,UPDATE/invoices.*:ALL state=present

### mysql db

Same as above, except the parameter is 'db':

mysql_db loginpass=password db=mydata state=present
mysql_db loginpass=password db=mydata state=absent