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