feat: add role membership
This commit is contained in:
parent
b9ade3b702
commit
186894b7c1
3 changed files with 33 additions and 0 deletions
19
README.md
19
README.md
|
@ -24,6 +24,7 @@ Install and configure Postgresql
|
||||||
| postgresql_users | dict | no | | the users to manage |
|
| postgresql_users | dict | no | | the users to manage |
|
||||||
| postgresql_privileges | array | no | | set the privileges for roles |
|
| postgresql_privileges | array | no | | set the privileges for roles |
|
||||||
| postgresql_hba | array | no | | the hba authorizations |
|
| postgresql_hba | array | no | | the hba authorizations |
|
||||||
|
| postgresql_role_memberships | dict | no | | add membership in a role group |
|
||||||
|
|
||||||
### postgresql_config
|
### postgresql_config
|
||||||
|
|
||||||
|
@ -124,6 +125,24 @@ Example:
|
||||||
method: md5
|
method: md5
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### postgresql_role_memberships
|
||||||
|
|
||||||
|
| Name | Type | Required | Default | Comment |
|
||||||
|
|-----------|-------|----------|---------|-----------------------------------------|
|
||||||
|
| key | str | yes | | the group role name |
|
||||||
|
| roles | array | yes | | the roles name to add in the role group |
|
||||||
|
| state | str | no | present | if absent the memberships are deleted |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
postgres:
|
||||||
|
roles:
|
||||||
|
- myuser
|
||||||
|
state: present
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -5,6 +5,7 @@ postgresql_primary: false
|
||||||
postgresql_databases: []
|
postgresql_databases: []
|
||||||
postgresql_users: []
|
postgresql_users: []
|
||||||
postgresql_hba: []
|
postgresql_hba: []
|
||||||
|
postgresql_role_memberships: {}
|
||||||
postgresql_config: {}
|
postgresql_config: {}
|
||||||
postgresql_config_default:
|
postgresql_config_default:
|
||||||
data_directory: '/var/lib/postgresql/{{ postgresql_version }}/main'
|
data_directory: '/var/lib/postgresql/{{ postgresql_version }}/main'
|
||||||
|
|
|
@ -83,3 +83,16 @@
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: postgresql_primary
|
when: postgresql_primary
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
|
- name: manage role membership
|
||||||
|
community.postgresql.postgresql_membership:
|
||||||
|
groups: '{{ item.key }}'
|
||||||
|
target_roles: '{{ item.value.roles }}'
|
||||||
|
state: '{{ item.value.state|default("present") }}'
|
||||||
|
loop: '{{ postgresql_role_memberships|dict2items }}'
|
||||||
|
loop_control:
|
||||||
|
label: '{{ item.key }}'
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
|
when: postgresql_primary
|
||||||
|
tags: postgresql
|
||||||
|
|
Loading…
Reference in a new issue