Turgon37.postgresql_server
Ansible Role PostgreSQL
Description
:grey_exclamation: Before using this role, please know that all my Ansible roles are fully written and accustomed to my IT infrastructure. So, even if they are as generic as possible they will not necessarily fill your needs, I advice you to carrefully analyse what they do and evaluate their capability to be installed securely on your servers.
This roles can install and configure a PostgreSQL database.
Requirements
Require Ansible >= 2.4
Dependencies
OS Family
This role is available for Debian
Features
At this day the role can be used to :
- install PostgreSQL
- configure main service
- configure pg_hba
Configuration
Role variables
All variables which can be overridden are stored in defaults/main.yml file as well as in table below. To see default values please refer to this file.
| Name | Types/Values | Description |
|---|---|---|
postgresql_server__data_directory |
Path | The root database directory |
postgresql_server__listen_addresses |
List of addresses | List of addresses on which the server will listen for connections |
postgresql_server__roles |
Dict of role/user | Dict of user/role to ensure in postgresql server |
postgresql_server__databases |
||
postgresql_server__service_restartable |
Boolean | Allow or not ansible to restart the database on changes that require it |
PostgreSQL role/user
Example
Playbook
- Install and configure a non built-in exporter type as follows :
- hosts: all
roles:
- role: turgon37.postgresql_server
vars:
postgresql_server__listen_addresses:
- 10.1.1.2
- 127.0.0.1
postgresql_server__hba_rules_host:
- type: host
database: app1
user: app1
address: 10.1.1.1/32
method: md5
postgresql_server__roles:
admin:
password: '{{ vault__admin }}'
profile: admin
app1:
password: '{{ vault__app1 }}'
profile: simple-applicative-user
app1ro:
password: '{{ vault__app1ro }}'
profile: simple-applicative-user
privileges:
- database: app1
type: database
privs: CONNECT
- database: app1
type: schema
objs: public
privs: USAGE
- database: app1
objs: ALL_IN_SCHEMA
privs: SELECT
postgresql_server__databases:
app1:
owner: app1
Install
ansible-galaxy install Turgon37.postgresql_serverLicense
mit
Downloads
137
Owner
Ingénieur, Informaticien, curieux de nouvelles technologies. Passionné par le libre et l'esprit de communauté
