diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e50a6c..d0277ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ## [Unreleased] +### Added + +add variable postrgresql_primary + ## v1.0.0 - 2021-09-10 - first version diff --git a/README.md b/README.md index 47556fd..73f9c5d 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,14 @@ Install and configure Postgresql ## Role variables -| Name | Type | Required |Default | Comment | -|------------------------------------|-------|----------|--------|--------------------------------------------------------| -| postgresql_version | str | no | 13 | the major version to use | -| postgresql_use_official_repository | bool | no | false | set to true if you want official postgresql repository | -| postgresql_config | dict | no | | add option config file | -| postgresql_databases | array | no | | the database to manage | -| postgresql_users | array | no | | the users to manage | +| Name | Type | Required |Default | Comment | +|------------------------------------|-------|----------|--------|-----------------------------------------------------| +| postgresql_version | str | no | 13 | the major version to use | +| postgresql_use_official_repository | bool | no | false | set true if you want official postgresql repository | +| postgresql_primary | bool | no | false | set true to create user and database on this server | +| postgresql_config | dict | no | | add option config file | +| postgresql_databases | array | no | | the database to manage | +| postgresql_users | array | no | | the users to manage | ### postgresql_config diff --git a/defaults/main.yml b/defaults/main.yml index 0a9272e..5ce1eac 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,7 @@ --- postgresql_version: 13 postgresql_use_official_repository: false +postgresql_primary: false postgresql_databases: [] postgresql_users: [] postgresql_config: {} diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index b049584..7ef0ab6 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -5,6 +5,7 @@ - ansible-role-postgresql vars: postgresql_use_official_repository: true + postgresql_primary: true postgresql_config: listen_addresses: '*' postgresql_hba: diff --git a/tasks/main.yml b/tasks/main.yml index e207a9d..0d4c548 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -51,6 +51,7 @@ loop: '{{ postgresql_databases }}' become: true become_user: postgres + when: postgresql_primary tags: postgresql - name: manage users @@ -65,4 +66,5 @@ label: '{{ item.name }}/{{ item.database }}' become: true become_user: postgres + when: postgresql_primary tags: postgresql