]>
Commit | Line | Data |
---|---|---|
d0bc90e0 P |
1 | ## PostgreSQL Ansible role [![Build Status](https://travis-ci.org/trainline-eu/postgresql.svg?branch=master)](https://travis-ci.org/trainline-eu/postgresql) |
2 | ||
3 | Ansible role which installs and configures PostgreSQL clusters, databases and users. | |
4 | ||
5 | #### Installation | |
6 | ||
7 | This role has been tested on Ansible 2.3.0 and higher. | |
8 | ||
9 | To install: | |
10 | ||
11 | ``` | |
12 | ansible-galaxy install trainline-eu.postgresql | |
13 | ``` | |
14 | ||
15 | ||
16 | #### Dependencies | |
17 | ||
18 | No dependencies | |
19 | ||
20 | Recommended dependencies: | |
21 | - trainline-eu.barman | |
22 | ||
23 | #### Compatibility matrix | |
24 | ||
25 | This table lists the tested version of OS/PostgreSQL couples. | |
26 | ||
27 | | Distribution / PostgreSQL | 9.1 | 9.4 | 9.5 | 9.6 | 10 | 11 | | |
28 | | ------------------------- |:---:|:---:|:---:|:---:|:---:|:---:| | |
91a1727f TH |
29 | | Debian 8.x | :no_entry: :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| |
30 | | Debian 9.x | :no_entry: :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| | |
d0bc90e0 P |
31 | |
32 | - :white_check_mark: - tested, works fine | |
33 | - :grey_question: - will work in the future (help out if you can) | |
34 | - :interrobang: - maybe works, not tested | |
35 | - :no_entry: - PostgreSQL has reached EOL | |
36 | ||
37 | ||
38 | #### Variables | |
39 | ||
40 | ```yaml | |
41 | # Basic settings | |
42 | postgres_listen_addresses: [ '127.0.0.1' ] # Optional | |
43 | postgres_log_dir: '/home/postgres-logs' # Optional | |
44 | postgres_data_dir: '/home/postgres' # Optional | |
45 | postgres_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 | |
61 | ||
62 | # Postgres config (Optional) | |
63 | postgres_log_line_prefix: '%m [%p] database: %d host: %h user: %u ' | |
64 | postgres_datestyle: 'iso, dmy' | |
65 | postgres_locale_formats: fr_FR.UTF-8 | |
66 | postgres_text_search_config: pg_catalog.french | |
67 | ||
68 | # Postgres pg_hba config (optional) | |
69 | postgres_allowed_hosts: | |
70 | - user: all | |
71 | range: 10.0.0.0/24 | |
72 | postgres_replication_hosts: | |
73 | - user: replicator | |
74 | range: 10.0.0.0/24 | |
75 | ``` | |
76 | ||
77 | #### Testing | |
78 | ||
79 | This 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. | |
80 | ||
81 | Coverage of this playbook is probably not complete but at least it's there. | |
82 | ||
83 | If 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). | |
84 | ||
85 | #### License | |
86 | ||
87 | Licensed under the MIT License. See the [LICENSE](./LICENSE) file for details. | |
88 | ||
89 | ||
90 | #### Thanks | |
91 | ||
92 | Creators: | |
93 | - [Gaëtan Duchaussois](https://twitter.com/gduchaussois) | |
94 | - [Théophile Helleboid](https://twitter.com/chtitux) | |
95 | - [Paul Bonaud](https://twitter.com/paulRb_r) | |
96 | ||
97 | Maintainers: | |
98 | - [Théophile Helleboid](https://twitter.com/chtitux) | |
99 | - [Paul Bonaud](https://twitter.com/paulRb_r) | |
100 | ||
101 | #### Feedback, bug-reports, requests, ... | |
102 | ||
103 | Are [welcome](https://github.com/trainline-eu/postgresql/issues)! |