Commit Graph

13 Commits (e170d7304b3ee5cda2c58e22b2b4aabe6a6a3a34)

Author SHA1 Message Date
Jan-Piet Mens 754888d896 DOCUMENTATION for fetch,mount,ohai,easy_install
- .rst now supresses default if none is set (looks better in HTML)
  - .rst now handles empty options list
  - Fixed postgresql_user and mysql_user because YAML contained colons
  - docs for facter
12 years ago
Marco Vito Moscaritolo e30e9a74c2 Added DOCUMENTATION to postgresql_user module. 12 years ago
Lorin Hochstein b3b01bb7a3 Fix postgresql_user bug
If I create a database from scratch and assign permissions by doing:

      - name: ensure database is created
        action: postgresql_db db=$dbname

      - name: ensure django user has access
        action: postgresql_user db=$dbname user=$dbuser priv=ALL password=$dbpassword

Then it fails with the error:

  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 565, in <module>
    main()
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 273, in main
    changed = grant_privileges(cursor, user, privs) or changed
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 174, in grant_privileges
    changed = grant_func(cursor, user, name, privilege)\
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 132, in grant_database_privilege
    prev_priv = get_database_privileges(cursor, user, db)
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 118, in get_database_privileges
    r = re.search('%s=(C?T?c?)/[a-z]+\,?' % user, datacl)
  File "/usr/lib/python2.7/re.py", line 142, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or buffer

This fix fixes the problem by not executing the regex if the
db query on pg_database returns None.
12 years ago
Piotr Kweclich 8360f9f46c added support for custom port definition 12 years ago
Pepe Barbe 6d473df324 Typo 12 years ago
Pepe Barbe af5d67c496 Query for all active privileges instead
Use a different method to query for current 
privileges at the table and database level. 
This method is more robust if newer privileges 
are added in future versions and also supports the 
ALL wildcard.
12 years ago
Pepe Barbe 95169b75c4 Add fail_on_user option
fail_on_user option can be used to ignore silently
if the user cannot be removed because of remaining
privilege dependencies to other objects in the 
database. By default it will fail, so that this new 
behavior won't surprise unsuspecting users.
12 years ago
Pepe Barbe 4e833cf506 Initial commit of change of semantics for module
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.
12 years ago
Pepe Barbe 3dd2c0700f Syntax change to make module compatible with Python 2.4 12 years ago
Michael DeHaan 7e9e29011e Add encoding lines to python modules such that they can take unicode options if they are fed them, since the
AnsibleModule stuff no longer base64 encodes for simplicity and speed reasons.
12 years ago
Michael DeHaan 0a3ebdb6d5 Module consistency and make daisy chaining work with invalid arguments detection. 12 years ago
Lorin Hochstein dcd214a631 Use standard argument names in PostgreSQL modules
passwd -> password
loginpass -> login_password
loginuser -> login_user
loginhost -> login_host

Add an example playbook that shows how to use the modules.
12 years ago
Lorin Hochstein def1fa23f8 Add postgresql_db and postgresql_user module.
These modules are based on the mysql_db and mysql_user modules.

Currently, the postgresql_user module can only grant all permissions
on a database, fine-grained access has not been implemented yet.
12 years ago