Ansible创建可以访问所有表的postgresql用户?

cla*_*lay 14 postgresql ansible ansible-playbook

这应该很简单.我想创建一个Ansible语句来创建一个Postgres用户,该用户具有对特定数据库的连接权限,并为该特定数据库中的所有表选择/插入/更新/删除权限.我尝试了以下方法:

  - name: Create postgres user for my app
    become: yes
    become_user: postgres
    postgresql_user:
      db: "mydatabase"
      name: "myappuser"
      password: "supersecretpassword"
      priv: CONNECT/ALL:SELECT,INSERT,UPDATE,DELETE
Run Code Online (Sandbox Code Playgroud)

我明白了 relation \"ALL\" does not exist

如果我删除ALL:,我得到Invalid privs specified for database: INSERT UPDATE SELECT DELETE

Int*_*nti 14

我必须做的是首先创建用户,然后单独授予权限.它的工作就像一个魅力.

 - name: Create postgres user for my app
    become: yes
    become_user: postgres
    postgresql_user:
      name: "myappuser"
      password: "supersecretpassword"

  - name: Ensure we have access from the new user
    become: yes
    become_user: postgres
    postgresql_privs:
      db: mydatabase
      role: myappuser
      objs: ALL_IN_SCHEMA
      privs: SELECT,INSERT,UPDATE,DELETE
Run Code Online (Sandbox Code Playgroud)