diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml index 2513b8e..039dc4d 100644 --- a/roles/postgres/tasks/main.yml +++ b/roles/postgres/tasks/main.yml @@ -42,28 +42,17 @@ enabled: true become: true -- name: Setup postgresql databases - community.postgresql.postgresql_db: - name: "{{ item.database }}" - with_items: "{{ postgres_users }}" - become: true - become_user: postgres - - name: Setup postgresql users community.postgresql.postgresql_user: - db: "{{ item.database }}" user: "{{ item.username }}" with_items: "{{ postgres_users }}" become: true become_user: postgres -- name: Grant users permissions to create tables in the schema `public` - community.postgresql.postgresql_privs: - db: "{{ item.database }}" - privs: CREATE - type: schema - objs: public - role: "{{ item.username }}" +- name: Setup postgresql databases + community.postgresql.postgresql_db: + name: "{{ item.database }}" + owner: "{{ item.username }}" with_items: "{{ postgres_users }}" become: true become_user: postgres