--- - name: Install PostgreSQL server ansible.builtin.package: name: postgresql state: present - name: Create Hydra database community.postgresql.postgresql_db: name: "{{ hydra_db_name }}" encoding: UTF-8 template: template0 state: present become_user: postgres - name: Create Hydra database user community.postgresql.postgresql_user: name: "{{ hydra_db_user }}" password: "{{ hydra_db_password }}" state: present become_user: postgres - name: Grant permissions on Hydra database to Hydra database user community.postgresql.postgresql_privs: database: "{{ hydra_db_name }}" privs: CONNECT type: database role: "{{ hydra_db_user }}" become_user: postgres - name: Grant permissions on public schema of Hydra database to Hydra database user community.postgresql.postgresql_privs: database: "{{ hydra_db_name }}" objs: public privs: CREATE,USAGE type: schema role: "{{ hydra_db_user }}" become_user: postgres