- name: create a new database become: yes become_user: postgres postgresql_db: # login_unix_socket: /var/run/mysqld/mysqld.sock name: '{{ DB_NAME }}' state: present - name: create a new user in database become: yes become_user: postgres postgresql_user: # login_unix_socket: /var/run/mysqld/mysqld.sock db: '{{ DB_NAME }}' name: '{{ DB_USER_NAME }}' password: '{{ DB_USER_PASSWORD }}' priv: ALL expires: infinity # - name: grant all privileges # become: yes # become_user: postgres # postgresql_privs: # db: "{{ 'DB_NAME' }}" # privs: ALL # type: database # role: