From 44ac805f2ced519b1da59867c01f545f55473082 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Tue, 9 Nov 2021 11:40:21 +0100 Subject: [PATCH] feat: add user attributes --- CHANGELOG.md | 1 + README.md | 17 ++++++++++------- molecule/default/converge.yml | 3 +++ tasks/main.yml | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aaab35..7d7e15d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Added - add variable postrgresql_primary +- add user attributes ### Fixed diff --git a/README.md b/README.md index b761725..f4bd601 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 7ef0ab6..9e95d41 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -23,6 +23,9 @@ password: secret privileges: - ALL + attributes: + - REPLICATION + - INHERIT pre_tasks: - name: update apt cache diff --git a/tasks/main.yml b/tasks/main.yml index 0d4c548..6fe6965 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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: