postgresql_user and granting select on pg_stat_database

475 views
Skip to first unread message

Brent Clark

unread,
Mar 18, 2015, 10:27:31 PM3/18/15
to ansible...@googlegroups.com
Hello,

I am trying to use the postgresql_user function to create and grant privs on the user. Im getting failure messages relating to the priv.

- postgresql_user: name=bobby password={{ pg_dd_password }} db=pg_stat_database priv=SELECT state=present

What I want basically to do is the following 

create user bobby with password 'some_password';
grant SELECT ON pg_stat_database to bobby;

I think my issue is that pg_stat_database isnt really a database or a table, but a collection of views, if I am understanding postgresql correctly.

Any help is appreciated. 

An Internet Denizen

unread,
Mar 19, 2015, 8:43:35 AM3/19/15
to ansible...@googlegroups.com

Brent Clark

unread,
Mar 19, 2015, 12:41:25 PM3/19/15
to ansible...@googlegroups.com
Im guessing grant privs on views isnt supported with postgresql_user or postgresql_privs?

Brent Clark

unread,
Mar 19, 2015, 12:50:11 PM3/19/15
to ansible...@googlegroups.com
I was able to get this working. Was just thinking about it in the wrong context. Place working code here for others. Thanks everyone!

- postgresql_user: name=bobby password={{ pg_dd_password }} db=postgres priv=pg_stat_database:SELECT state=present
Reply all
Reply to author
Forward
0 new messages