ansible/ansible — pull request #924 by elventear (2012-08-21 19:38:08+00:00)
Title: Change semantics of postgresql_user module

This is the proposal for several changes into the semantics and behavior of the postgresql_user. The postgresql_user module has several drawbacks:

* No granularity for privileges
* PostgreSQL semantics force working on one database at time, at least for Tables. Which means that a single call can't remove all the privileges for a user, and a user can't be removed until all the privileges are removed, forcing a module failure with no way to work around the issue.
Changes:
* Added the ability to specify granular privileges for database and tables within the database
* Report if user was removed, and add an option to disable failing if user is not removed.

Interface changes:
* Added fail_on_user. If 'yes' (default) if the statement requires indicates an absent state and the user cannot be removed (Because of other privileges lingering, probably in a different database), the module will fail. Otherwise, it will succeed but indicate in the output that the user was not removed. This allows to do several consecutive calls to different databases until the user can be finally removed.
* Added privs, with a similar syntax to the mysql_usr. See the comments in the code.

Let me know any feedback for the code. If it looks good, I will rewrite the help files and submit them in a separate pull request.