han*_*rik 11 postgresql privileges ansible
有关如何定义用户权限的postgresql_user模块的文档与格式有关.格式在选项表中描述如下:
priv | PostgreSQL privileges string in the format: table:priv1,priv2
Run Code Online (Sandbox Code Playgroud)
但是,下面给出的示例使用另一种格式
priv: "CONNECT/products:ALL"
priv: "ALL/products:ALL"
# Example privileges string format
INSERT,UPDATE/table:SELECT/anothertable:ALL
Run Code Online (Sandbox Code Playgroud)
博客文章Ansible Loves PostgreSQL提到了另一种格式:
priv: Privileges in “priv1/priv2” or table privileges in “table:priv1,priv2,…” format
Run Code Online (Sandbox Code Playgroud)
我在创建具有只读访问权限的用户时遇到问题,即对所有表的SELECT权限.
有人能否对正确使用的格式有所了解,例如为用户提供所有表的只读访问权限?
在源码中postgresl_user
有一个parse_privs
函数。这似乎是预期格式的最佳来源priv
:
Format:
privileges[/privileges/...]
Where:
privileges := DATABASE_PRIVILEGES[,DATABASE_PRIVILEGES,...] |
TABLE_NAME:TABLE_PRIVILEGES[,TABLE_PRIVILEGES,...]
Run Code Online (Sandbox Code Playgroud)
它看起来像是/
权限的分隔符,:
是表名的分隔符,以及该表的权限。,
分离表的权限。