feat: add user attributes

This commit is contained in:
Adrien Waksberg 2021-11-09 11:40:21 +01:00
parent 0559d59d56
commit 44ac805f2c
4 changed files with 15 additions and 7 deletions

View file

@ -8,6 +8,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Added ### Added
- add variable postrgresql_primary - add variable postrgresql_primary
- add user attributes
### Fixed ### Fixed

View file

@ -60,13 +60,14 @@ Example:
### postgresql_users ### postgresql_users
| Name | Type | Required | Default | Comment | | Name | Type | Required | Default | Comment |
|------------|-------|----------|---------|-------------------------------------------------------| |------------|-------|----------|---------|---------------------------------------------------------------|
| name | str | yes | | the user name | | name | str | yes | | the user name |
| password | str | yes | | the password to logon | | password | str | yes | | the password to logon |
| database | str | yes | | the database where user's permissions will be granted | | database | str | yes | | the database where user's permissions will be granted |
| privileges | array | yes | | list with the user's privileges | | privileges | array | yes | | list with the user's privileges |
| state | str | no | present | if absent the user is deleted | | attributes | array | yes | | list with the user's attributes (REPLICATION, SUPERUSER, ...) |
|statee | str | no | present | if absent the user is deleted |
Example: Example:
@ -77,6 +78,8 @@ Example:
privileges: privileges:
- SELECT - SELECT
- table1:INSERT - table1:INSERT
attributes:
- REPLICATION
state: present state: present
``` ```

View file

@ -23,6 +23,9 @@
password: secret password: secret
privileges: privileges:
- ALL - ALL
attributes:
- REPLICATION
- INHERIT
pre_tasks: pre_tasks:
- name: update apt cache - name: update apt cache

View file

@ -60,6 +60,7 @@
password: '{{ item.password }}' password: '{{ item.password }}'
db: '{{ item.database }}' db: '{{ item.database }}'
priv: '{{ item.privileges|join("/") }}' priv: '{{ item.privileges|join("/") }}'
role_attr_flags: '{{ item.attributes|join(",")|default("") }}'
state: '{{ item.state|default("present") }}' state: '{{ item.state|default("present") }}'
loop: '{{ postgresql_users }}' loop: '{{ postgresql_users }}'
loop_control: loop_control: