# file: postgresql/tasks/users_privileges.yml - name: PostgreSQL | Update the user privileges postgresql_user: name: "{{item.name}}" db: "{{item.db | default(omit)}}" port: "{{postgresql_port}}" priv: "{{item.priv | default(omit)}}" state: present login_host: "{{item.host | default(omit)}}" login_user: "{{postgresql_admin_user}}" role_attr_flags: "{{item.role_attr_flags | default(omit)}}" sudo: yes sudo_user: "{{postgresql_admin_user}}" with_items: postgresql_user_privileges when: postgresql_users|length > 0