postgresql_user

Collection: community.general

Full Name: parallax.community.general.postgresql_user

Aliases: community.general.postgresql_user, 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_hoststringlocalhostHost 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)
privstringPrivileges to grant
expiresstringPassword expiration date
conn_limitint-1Connection limit for the user
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

Example

- name: Create the application role
  postgresql_user:
    name: app
    password: "{{ pg_app_password }}"
    db: appdb
    role_attr_flags: LOGIN,NOSUPERUSER
    state: present