PARALLAX

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

NameTypeRequiredDefaultDescription
namestringyesName of the PostgreSQL user (role)
passwordstringPassword for the user
statestringpresentState of the user Choices: present, absent
dbstringName of database to connect to
login_hoststringHost running the database
login_userstringpostgresUser to authenticate with
login_passwordstringPassword for authentication
portint5432Database port to connect to
role_attr_flagsstringRole attribute flags (e.g. SUPERUSER,CREATEDB)
privstringLegacy option; use postgresql_privs to manage grants
expiresstringPassword expiration date
conn_limitintConnection limit for the user; -1 means unlimited
encryptedbooltrueWhether the password is stored encrypted
no_password_changesboolfalseDo not change the password if the user already exists
fail_on_userbooltrueFail when user cannot be removed
ssl_modestringpreferSSL mode for the connection
commentstringRole comment
session_rolestringRole to assume for operations
configurationdictPer-role PostgreSQL settings
reset_unspecified_configurationboolfalseReset settings omitted from configuration
quote_configuration_valuesbooltrueQuote configuration values
trust_inputbooltrueRetained compatibility option; SQL values are always quoted
login_unix_socketstringUnix socket directory
ca_certstringCA certificate path
ssl_certstringClient certificate path
ssl_keystringClient 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
Search
    ↑ ↓ move↵ openesc close