- name: Create db user become_user: postgres postgresql_user: name: mailuser password: "{{ mailuser_password }}" - name: Create database become_user: postgres postgresql_db: name: mailarchiver owner: mailuser - name: Grant schema rights become_user: postgres postgresql_query: db: mailarchiver query: | GRANT ALL ON SCHEMA public TO mailuser; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO mailuser;