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
- add variable postrgresql_primary
- add user attributes
### Fixed

View file

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

View file

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

View file

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