]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blame - README.md
Merge pull request #11 from paulrbr-fl/postgresql-12
[github/fretlink/ansible-postgresql-role.git] / README.md
CommitLineData
8371771c 1## PostgreSQL Ansible role [![Build Status](https://travis-ci.org/trainline-eu/ansible-postgresql-role.svg?branch=master)](https://travis-ci.org/trainline-eu/ansible-postgresql-role)
d0bc90e0
P
2
3Ansible role which installs and configures PostgreSQL clusters, databases and users.
4
8371771c
TH
5See [role page on Ansible Galaxy](https://galaxy.ansible.com/trainline-eu/ansible_postgresql_role).
6
d0bc90e0
P
7#### Installation
8
8d168915 9This role has been tested on Ansible 2.5.0 and higher.
d0bc90e0
P
10
11To install:
12
13```
b91d7341 14ansible-galaxy install trainline-eu.ansible_postgresql_role
d0bc90e0
P
15```
16
d0bc90e0
P
17#### Dependencies
18
19No dependencies
20
21Recommended dependencies:
8371771c 22- [trainline-eu.ansible_barman_role](https://galaxy.ansible.com/trainline-eu/ansible_barman_role)
d0bc90e0
P
23
24#### Compatibility matrix
25
26This table lists the tested version of OS/PostgreSQL couples.
27
8d168915
P
28| Distribution / PostgreSQL | 9.1 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 |
29| ------------------------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
30| Debian 8.x | :no_entry: :white_check_mark: | :no_entry: :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
31| Debian 9.x | :no_entry: :white_check_mark: | :no_entry: :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
d0bc90e0
P
32
33- :white_check_mark: - tested, works fine
34- :grey_question: - will work in the future (help out if you can)
35- :interrobang: - maybe works, not tested
36- :no_entry: - PostgreSQL has reached EOL
37
d0bc90e0
P
38#### Variables
39
40```yaml
41# Basic settings
42postgres_listen_addresses: [ '127.0.0.1' ] # Optional
43postgres_log_dir: '/home/postgres-logs' # Optional
44postgres_data_dir: '/home/postgres' # Optional
45postgres_clusters: # Mandatory
91a1727f 46 - version: 11 # Mandatory
d0bc90e0
P
47 name: 'main' # Mandatory
48 port: 5432 # Mandatory
49 checksums: True # Optional
50 fsync_enabled: False # Optional
51 archive_enabled: False # Optional
52 # List of users to be created (optional)
53 users:
54 - username: 'replicator' # Mandatory
55 password: 'SuperSecret' # Mandatory
56 permissions: 'REPLICATION' # Mandatory
57 # List of databases to be created (optional)
58 databases:
59 - dbname: my_database # Mandatory
60 owner: john # Mandatory
7b241a44
P
61 extensions: # Optional
62 - names: [ 'postgis', 'postgis_topology' ]
63 apt_deps: [ 'postgresql-11-postgis' ]
d0bc90e0
P
64
65# Postgres config (Optional)
66postgres_log_line_prefix: '%m [%p] database: %d host: %h user: %u '
67postgres_datestyle: 'iso, dmy'
68postgres_locale_formats: fr_FR.UTF-8
69postgres_text_search_config: pg_catalog.french
70
71# Postgres pg_hba config (optional)
72postgres_allowed_hosts:
73 - user: all
74 range: 10.0.0.0/24
75postgres_replication_hosts:
76 - user: replicator
77 range: 10.0.0.0/24
29f3186f
TH
78
79# Ansible related Configuration
80postgres_become_method: su # Optional
99504fed
TH
81
82# Barman connectivity
83postgres_barman_server: barman.example.com # Required if at least one server has archive_enabled enabled
84postgres_barman_rsync_enabled: False # Optional
85postgres_barman_rsync_options: '' # Optional
86postgres_barman_remote_user: barman # Optional
87postgres_barman_path_prefix: '~' # Optional, required if using rsync
d0bc90e0
P
88```
89
90#### Testing
91
92This project comes with a `test/main.yml` testing playbook. It uses `Docker` to provision containers locally and sets up a 3 node postgresql cluster with a barman server.
93
94Coverage of this playbook is probably not complete but at least it's there.
95
96If you are contributing, please first test your changes in a new playbook in the `test/` directory within docker containers, (using the targeted distribution), and if possible, ensure your change is covered in the tests found in [.travis.yml](./.travis.yml).
97
98#### License
99
100Licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
101
102
103#### Thanks
104
105Creators:
106- [Gaëtan Duchaussois](https://twitter.com/gduchaussois)
107- [Théophile Helleboid](https://twitter.com/chtitux)
108- [Paul Bonaud](https://twitter.com/paulRb_r)
109
110Maintainers:
111- [Théophile Helleboid](https://twitter.com/chtitux)
112- [Paul Bonaud](https://twitter.com/paulRb_r)
113
114#### Feedback, bug-reports, requests, ...
115
116Are [welcome](https://github.com/trainline-eu/postgresql/issues)!