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.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
apt | Loading commit data... | |
apt_repository | Loading commit data... | |
assemble | Loading commit data... | |
async_status | Loading commit data... | |
async_wrapper | Loading commit data... | |
authorized_key | Loading commit data... | |
command | Loading commit data... | |
copy | Loading commit data... | |
easy_install | Loading commit data... | |
facter | Loading commit data... | |
fetch | Loading commit data... | |
file | Loading commit data... | |
get_url | Loading commit data... | |
git | Loading commit data... | |
group | Loading commit data... | |
lineinfile | Loading commit data... | |
mount | Loading commit data... | |
mysql_db | Loading commit data... | |
mysql_user | Loading commit data... | |
nagios | Loading commit data... | |
ohai | Loading commit data... | |
ping | Loading commit data... | |
pip | Loading commit data... | |
postgresql_db | Loading commit data... | |
postgresql_user | Loading commit data... | |
raw | Loading commit data... | |
seboolean | Loading commit data... | |
selinux | Loading commit data... | |
service | Loading commit data... | |
setup | Loading commit data... | |
shell | Loading commit data... | |
slurp | Loading commit data... | |
subversion | Loading commit data... | |
supervisorctl | Loading commit data... | |
template | Loading commit data... | |
user | Loading commit data... | |
virt | Loading commit data... | |
wait_for | Loading commit data... | |
yum | Loading commit data... |