From 8898643c1d454aa3138874e6d4dd2c73035630f4 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Sat, 29 Sep 2012 16:15:41 +0200 Subject: [PATCH] Added DOCUMENTATION to musql_user module. --- library/mysql_user | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/library/mysql_user b/library/mysql_user index 5a4062b68d2..e35cce3c02d 100755 --- a/library/mysql_user +++ b/library/mysql_user @@ -18,6 +18,69 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +DOCUMENTATION = ''' +--- +module: mysql_user +short_description: Adds or removes a user from a MySQL database. +description: + - Adds or removes a user from a MySQL database. +version_added: "0.6" +options: + name: + description: + - name of the user (role) to add or remove + required: true + default: null + password: + description: + - set the user's password + required: false + default: null + host: + description: + - the 'host' part of the MySQL username + required: false + default: localhost + login_user: + description: + - The username used to authenticate with + required: false + default: null + login_password: + description: + - The passwordused to authenticate with + required: false + default: null + login_host: + description: + - Host running the database + required: false + default: localhost + priv: + description: + - MySQL privileges string in the format: db.table:priv1,priv2 + required: false + default: null + state: + description: + - The database state + required: false + default: present + choices: [ "present", "absent" ] +examples: + - code: mysql_user name=bob password=12345 priv=*.*:ALL state=present + description: Create database user with name 'bob' and password '12345' with all database privileges + - code: mysql_user login_user=root login_password=123456 name=sally state=absent + description: Ensure no user named 'sally' exists, also passing in the auth credentials. + - code: mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL + description: Example privileges string format +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. +requirements: [ ConfigParser ] +author: Mark Theunissen +''' + import ConfigParser try: import MySQLdb