Commit Graph

191 Commits (778e51c6b14f700181570034dd64e63713da9055)

Author SHA1 Message Date
Maykel Moya 5da6fcae4d Add support for string values
The SET GLOBAL statement requires properly quoting of values. For example, the
following correct queries will fail if quotes are toggled:

mysql> SET GLOBAL innodb_lru_scan_depth = 2000;
mysql> SET GLOBAL master_info_repository = "TABLE";

`mysql_variable` module doesn't quote the value argument, therefore
string values will fail.

  # this task will pass, 2000 is passed without quotes
  - name: set a numeric value
    mysql_variable: variable=innodb_lru_scan_depth value=2000

  # this task will fail, TABLE is passed without quotes
  - name: set a string value
    mysql_variable: variable=master_info_repository value=TABLE

With this patch prepared statements are used. Proper quoting will be
done automatically based on the type of the variables thus an attempt
to convert to int, then to float is done in first place.

Booleans values, ie: ON, OFF, are not specially handled because they
can be quoted. For example, the following queries are correct and
equivalent, they all set _innodb_file_per_table_ to logical _True_:

mysql> SET GLOBAL innodb_file_per_table = "ON";
mysql> SET GLOBAL innodb_file_per_table = ON;
mysql> SET GLOBAL innodb_file_per_table = 1;

Tested in mysql 5.5 and 5.6.
11 years ago
Arturs Vonda df853fa92e Added port documentation to postgresql_db and postgresql_user 11 years ago
George Miroshnykov 58e34edce3 Add idempotency to mongodb_user module 11 years ago
Matthew Jones 3ddfc8d471 Allow strings containing single and double quotes to be used as passwords for postgres_user 11 years ago
Timur Batyrshin 9ad52632c5 reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852) 11 years ago
Matthew Leventi 1637438298 adding the ability to change redis configuration 11 years ago
jctanner 7bab8656a3 Merge pull request #5435 from jkleckner/fix-mysql-dump-import
mysql_db module: make dump and import to use port argument
11 years ago
David Busby ab8d5c5924 Documentation update to yield example of "WITH GRANT OPTION" which is undocumented previous 11 years ago
Alan Fairless 927a30c404 Fix postgresql_user to understand PG namespaces
Previously postgresql_user quoted user supplied identifers to create
grant statements that look like this:

    GRANT SELECT on "tablename" to "user";

Which only works if the tablename is not in a namespace.  If you supply
a namespaced tabelname like "report.revenue" then it creates this
incorrect statement:

    GRANT SELECT on "report.revenue" to "user";

Which will not find the "revenue" table in the "report" namespace, but
will rather look for a table named "report.revenue" in the current
(default public) namespace.  The correct form is:

    GRANT SELECT on "report"."revenue" to "user";

This approach could have the unfortunate effect that code that
previously relied on the other behavior to grant privileges on tables
with periods in their names may now break.  PostgreSQL users
typically shouldn't name tables as such, and users can still access the
old behavior and use tablenames with periods in the if they must by
supplying their own quoting.
11 years ago
Jim Kleckner 8ba9019797 Add quotes to password argument for dump/import
The password is passed on a command line for dump and import and needs
quoting.

Ideally, this would not be passed on a command line at all - any ideas?
Or at least have a stronger form of quoting so that embedded single
quotes will be escaped.
11 years ago
Jinn Koriech 57dc4fbea2 postgresql_user module: Gracefully handle ALTER ROLE on read-only postgres servers. 11 years ago
Jim Kleckner 59396d38e2 Fix mysql_db dump and import to use port argument
The code for mysql_db did not pass the port argument when state=dump or
state=import.
11 years ago
jctanner 8b925e93e6 Merge pull request #5099 from tartansandal/postgresql_db_check_mode
postgres_db CHECKMODE changed status
11 years ago
Jinn Koriech fbb1018abe Fix postgresql_user documentation render 11 years ago
Jinn Koriech e1aa94896f Add documentation for usage of encrypted postgresql passwords. 11 years ago
James Tanner 4f9aadcc07 Addresses #5023 Fix import comments 11 years ago
James Tanner 38edad70ac Fixes #5023 Convert all modules to use new snippet import pattern 11 years ago
Kahlil (Kal) Hodgson 147783528c postgres_db CHECKMODE changed status
Make the changed status for postgres_db under CHECKMODE match the
status that would be returned normally.
11 years ago
Michael DeHaan 4c35b7f380 There's a cleaner way to do this, commit to module formatter pending.
Revert "No longer need to reference 'version_added' in docs for these, as this was quite a while ago."

This reverts commit ff0a41d446.
11 years ago
Michael DeHaan 9e4d71203d No longer need to reference 'version_added' in docs for these, as this was quite a while ago. 11 years ago
Michael DeHaan 08996d78d6 Add version_added to all modules missing version_added information, the docs formatter will now
raise errors when omitted, updated changelog with new modules.
11 years ago
James Tanner eccbd21a0d Fix typo in postgresql_user module docstrings 11 years ago
jctanner 6336129f59 Merge pull request #4686 from bcoca/postgresql_user_pwds
postgresql_user now supports users w/o a password, encrypted passwords and expiration
11 years ago
James Tanner f7db64d69b Merge pull request #4307 from damianmoore/mysql_gzip_bzip2_support
Add support for compressing mysql dumps and extracting during import.
11 years ago
Steve Tjoa de4b105e09 Changed parameter from 'user' to 'name' in the examples to coincide with the specs. 11 years ago
James Tanner 3370aee870 Fixes #4720 Use mysql command to restore database instead of mysqldump 11 years ago
Brian Coca 9b8b79f1fd updated to make note that password is required before v1.4
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
11 years ago
Brian Coca 0d9a6b63ea updated docs
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
11 years ago
Brian Coca cdec70eeff now supports users w/o a password, encrypted passwords and expiration
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
11 years ago
Maykel Moya 6155bf2c55 Fail if requested variable is not available 11 years ago
James Tanner 251b52bef8 Fixes #4454 Make a temporary clean cnf file if unable to parse existing 11 years ago
Maykel Moya 2d33cf898c Improve change detection in mysql_variables
mysql_variables bindly executes a SET var = value query even when
the variable already has the requested value.

With this patch the query is executed only if the current value is
different to the requested one.
11 years ago
James Tanner f233e29386 mysql_db: if connection is a socket, do not specify hostname 11 years ago
James Tanner 9128862b3b Fixes #4301 Use module_common functions for mysqldump and return better errors 11 years ago
Michael DeHaan c586ed5168 Merge pull request #4342 from pileofrogs/devel
mysql_replication switch to DictCursor for compatibility with more mysql server versions
11 years ago
Michael DeHaan daa005085d Add missing version_added doc to mysql login port parameter. 11 years ago
Dylan Martin 280ecaa453 toned down the error message for unconfigured master/slave 11 years ago
Jeroen Hoekx 19b52e9fb7 Add append_privs parameter to MySQL user module.
This adds the privileges given to the existing list of privileges
instead of overwriting any existing ones.
11 years ago
Dylan Martin 3c7f8d6272 switch to DictCursor 11 years ago
Damian Moore 85ed9af959 mysql_db now supports import and dump of gzip and bzip2 compressed files 11 years ago
James Cammarata 619a80c505 Merge branch 'devel' of https://github.com/tomdymond/ansible into tomdymond-devel 11 years ago
James Cammarata e62844653c Merge branch 'devel' of https://github.com/abompard/ansible into abompard-devel 11 years ago
James Cammarata d93edadbbb Merge branch 'fix_postgresql_db' of https://github.com/yteraoka/ansible into yteraoka-fix_postgresql_db 11 years ago
James Cammarata 51fedb64a9 Cleaning up pep8 whitepsace issues in the mysql_replication module 11 years ago
James Cammarata 07c825d8f5 Merge branch 'bugfix' of https://github.com/jsmartin/ansible into jsmartin-bugfix 11 years ago
James Martin 6539652a28 Fixes for python 2.4 support, better collection of riak version. 11 years ago
James Cammarata d16ba9758e Added version_added to the mysql_variables module doc section 11 years ago
James Cammarata 3fe2549363 Merge branch 'mysql_variables' of https://github.com/banyek/ansible into banyek-mysql_variables 11 years ago
James Cammarata 8dd3339d3a Added version_added to the mysql_replication module doc section 11 years ago
James Cammarata c5be708dd5 Merge branch 'mysql_replication' of https://github.com/banyek/ansible into banyek-mysql_replication 11 years ago
James Cammarata 0eaae4ac9c Cleaning up whitspace issues in the mysql_user module 11 years ago
John Hamelink 266255640e Fixed #3767 - mysql_user command fails with dots (and underscores) in
database names.
11 years ago
Aurélien Bompard e4cfa251e2 Module postgresql_privs: fix default arguments
Defaults arguments must not be added to the connection keywords, as
the other postgresql modules already do.

Closes #4043
11 years ago
Tom Dymond b3646176a9 Add option to specify the MySQL server port 11 years ago
TERAOKA Yoshinori b8a26eda0b fix get_db_info
using pg_roles instead of pg_user
if database owner is a role (not user) then it can not select form pg_user table.
11 years ago
James Cammarata 777b8be15f Fixing small typo in redis module documentation 11 years ago
James Cammarata 60e7da2031 Merge branch 'redis-config' of https://github.com/slok/ansible into slok-redis-config 11 years ago
James Cammarata 1bb4c9ab25 Cleaning up some pep8 whitespace issues in mongodb_user 11 years ago
James Cammarata 97a42d58fe Fixing up a small issue with the mongodb_user docs 11 years ago
Ben Podoll 3a351d0599 adding fixes to support older versions of mongo (and pymongo) as well as new versions 11 years ago
Ben Podoll 1de933aee3 adding comment about required version of mongodb to use the roles param 11 years ago
Ben Podoll 8fc19eb4fa adding the ability to specify roles when adding/modifying a mongo user 11 years ago
Dan Robinson 80c8a0bfd6 Brings postgresql_db examples in line with documentation.
As of now, the documentation lists a parameter as "name",
whereas the examples use a parameter called "db". This brings
them in line.
11 years ago
Balazs Pocze cb9a6a9c2c EXAMPLES section added 11 years ago
Balazs Pocze 1a108a227e Changes made in documentation (EXAMPLES section added)
Minor identation fixes
11 years ago
Michael DeHaan fab11537b1 Merge pull request #3691 from stoned/mysql_user-doc-fix
module mysql_user: fix 'state' parameter description
11 years ago
Balazs Pocze 3b9171077c mysql_replication module added 11 years ago
Balazs Pocze 39cc08e0f0 MySQL variables module 11 years ago
Stoned Elipot a0ce78e6e5 module mysql_user: fix 'state' parameter description 12 years ago
Stijn Tintel 7102503bb2 Only revoke GRANT OPTION when user actually has it
When revoking privileges from a user, the GRANT OPTION is always
revoked, even if the user doesn't have it. If the user exists, this
doesn't give an error, but if the user doesn't exist, it does:

mysql> GRANT ALL ON test.* TO 'test'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE GRANT OPTION ON test.* FROM 'test'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE GRANT OPTION ON test.* FROM 'test'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE ALL ON test.* FROM 'test'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE GRANT OPTION ON test.* FROM 'test'@'localhost';
ERROR 1141 (42000): There is no such grant defined for user 'test' on
host 'localhost'

Additionally, in MySQL 5.6 this breaks replication because of
http://bugs.mysql.com/bug.php?id=68892.

Rather than revoking the GRANT OPTION and catching the error, check if
the user actually has it and only revoke it when he does.
12 years ago
Xabier Larrakoetxea 564f2a99e7 Changed action keyword to command 12 years ago
Michael DeHaan 23e9e5c028 Add version_added information to module parameter. 12 years ago
Michael DeHaan 6f64c090c2 Merge pull request #3396 from adq/mysql
Check if mysql allows login as root/nopassword before trying supplied credentials.
12 years ago
Xabier Larrakoetxea 6fb37c5825 Added redis config module (slave and flush) 12 years ago
Jan-Piet Mens 683e9e27c0 mysql_db small fix to docs 12 years ago
James Martin 79a00eca47 Fixed #3433. Using get_bin_path, removed uneeded imports, "module" is inlined, misc other style improvements. 12 years ago
Andrew de Quincey 28ec499f2a Check if mysql allows login as root/nopassword before trying supplied credentials. 12 years ago
Jan-Piet Mens 98c1423269 Docs: consistently format playbook EXAMPLES 12 years ago
Michael DeHaan 3274cef6d1 Merge pull request #3172 from gw0/fix-mongodb2.2-compat
Fix `mongodb_user` compatibility with MongoDB 2.2 (used in Debian 7).
12 years ago
Michael DeHaan 653d78c23d Merge pull request #3177 from stintel/mysql56-compat
Fix MySQL 5.6 compatibility
12 years ago
Jan-Piet Mens 3404a0fc16 DOCS: standardize on EXAMPLES (a.k.a. Docs-JumboPatch JetLag Edition)
Migrated all examples: in DOCUMENTATION=''' string to standalone EXAMPLES=''' string
  Added deprecation warning to moduledev.rst and remove deprecated example from it
  Fixed up a few typos and uppercased some acronyms.
  add consistency to how EXAMPLES are formatted
12 years ago
Stijn Tintel 66ffef5967 Fix MySQL 5.6 compatibility
In MySQL 5.6, the root account created by default during MySQL
installation has the PROXY ... WITH GRANT OPTION privilege for ''@'',
that is, for all users.

The mysql_user module tries to revoke this privilege, but this fails:
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '''@'' FROM 'root'@'localhost''
at line 1")

Quick fix: don't revoke privilege if user is root and the privilege to
revoke contains PROXY.
12 years ago
gw0 [http://gw.tnode.com/] f86baf554c Fix `mongodb_user` compatibility with MongoDB 2.2 (used in Debian 7). 12 years ago
Michael DeHaan 3012d269ff pep8 fixes 12 years ago
Michael DeHaan fd62197cf1 Docs standardization 12 years ago
Michael DeHaan a6006f3c0f Docs standardization 12 years ago
James Martin 8fa7768e91 Now can specify amount of time to wait_for_handoffs or ring ready instead of booleans. 12 years ago
James Martin 9cfcede201 Timeouts implemented for riak stats operation. Removed failback mode
for fetching riak stats.
12 years ago
James Martin 0db8879915 Fixed docs. Fixed fallback status method. Fixed "changed" message with cluster commit. 12 years ago
Bernhard Weitzhofer d0d9ed5b9c postgresql_privs: fix wrong codec specification
Use psycopg2's mapping from PostgreSQL encoding names to Python codec names.
12 years ago
Michael DeHaan cd97a4cb14 Allow modules to be categorized, and also sort them when generating the documentation. 12 years ago