# module postgres\_privs unexpected behaviour with default privs

**URL:** <https://forum.ansible.com/t/module-postgres-privs-unexpected-behaviour-with-default-privs/29273>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [December 17, 2018, 2:41am UTC](https://forum.ansible.com/t/module-postgres-privs-unexpected-behaviour-with-default-privs/29273 "2018-12-17T02:41:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giannis\_Sialmas](https://avatars.discourse-cdn.com/v4/letter/g/97f17d/32.png) [@Giannis\_Sialmas](https://forum.ansible.com/u/Giannis_Sialmas)\
**Post date:** [December 17, 2018, 2:41am UTC](https://forum.ansible.com/t/module-postgres-privs-unexpected-behaviour-with-default-privs/29273/1 "2018-12-17T02:41:26Z")

</div>

Some details

`  
ansible 2.7.4  
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]

postgres version: PostgreSQL 10.6 (Ubuntu 10.6-1.pgdg16.04+1) on x86\_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609, 64-bit  
`

I’m trying to use the new functionality that came with ansible 2.7 of the module [postgresql\_privs](https://docs.ansible.com/ansible/latest/modules/postgresql_privs_module.html) that enables tweaking of default privilages but i have the following problem:

I want to convert a shell command i run on the target postgres host to the above module. The command is the following and is run by the postgres system user:

`  
shell: psql -d my\_database -c “ALTER DEFAULT PRIVILEGES FOR ROLE myuser IN SCHEMA public GRANT SELECT ON TABLES TO seconduser;”

`

The above command gives the expected read default permission to my seconduser as seen by the psql \ddp command:

`

my\_database=# \ddp  
Default access privileges  
Owner | Schema | Type | Access privileges
