postgresql_user
Create, alter and drop PostgreSQL login roles
Collection: community.postgresql
Full Name: parallax.community.general.postgresql_user
Aliases: community.general.postgresql_user, postgresql_user, community.postgresql.postgresql_user
Synopsis
Create, alter and drop PostgreSQL login roles
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | Name of the PostgreSQL user (role) | |
| password | string | Password for the user | ||
| state | string | present | State of the user Choices: present, absent | |
| db | string | Name of database to connect to | ||
| login_host | string | Host running the database | ||
| login_user | string | postgres | User to authenticate with | |
| login_password | string | Password for authentication | ||
| port | int | 5432 | Database port to connect to | |
| role_attr_flags | string | Role attribute flags (e.g. SUPERUSER,CREATEDB) | ||
| priv | string | Legacy option; use postgresql_privs to manage grants | ||
| expires | string | Password expiration date | ||
| conn_limit | int | Connection limit for the user; -1 means unlimited | ||
| encrypted | bool | true | Whether the password is stored encrypted | |
| no_password_changes | bool | false | Do not change the password if the user already exists | |
| fail_on_user | bool | true | Fail when user cannot be removed | |
| ssl_mode | string | prefer | SSL mode for the connection | |
| comment | string | Role comment | ||
| session_role | string | Role to assume for operations | ||
| configuration | dict | Per-role PostgreSQL settings | ||
| reset_unspecified_configuration | bool | false | Reset settings omitted from configuration | |
| quote_configuration_values | bool | true | Quote configuration values | |
| trust_input | bool | true | Retained compatibility option; SQL values are always quoted | |
| login_unix_socket | string | Unix socket directory | ||
| ca_cert | string | CA certificate path | ||
| ssl_cert | string | Client certificate path | ||
| ssl_key | string | Client private key path |
Example
yaml
- name: Create the application role
postgresql_user:
name: app
password: "{{ pg_app_password }}"
db: appdb
role_attr_flags: LOGIN,NOSUPERUSER
state: present