Skip to content

Commit 27879b9

Browse files
committed
Merge branch 'master' into fix_password_encryption
2 parents d65698b + 0bbc9f8 commit 27879b9

29 files changed

+90
-4825
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ services:
99

1010
env:
1111
matrix:
12-
- IMAGE_NAME="ubuntu:16.04-builded"
12+
## DISABLED ## - IMAGE_NAME="ubuntu:16.04-builded"
1313
- IMAGE_NAME="debian:8-builded"
1414
- IMAGE_NAME="debian:9-builded"
1515
- IMAGE_NAME="centos:7-builded"
16-
- IMAGE_NAME="centos:6-builded"
1716
## DISABLED ## - IMAGE_NAME="fedora:27-builded"
1817
install:
1918
- pip install ansible=="2.4.4.0" docker-py

README.md

+35-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## ANXS - PostgreSQL [![Build Status](https://travis-ci.org/ANXS/postgresql.svg?branch=master)](https://travis-ci.org/ANXS/postgresql)
1+
## ANXS - PostgreSQL [![Build Status](https://travis-ci.com/ANXS/postgresql.svg?branch=master)](https://travis-ci.com/ANXS/postgresql)
22

33
---
44
Help Wanted! If you are able and willing to help maintain this Ansible role then please open a GitHub issue. A lot of people seem to use this role and we (quite obviously) need assistance!
@@ -20,12 +20,32 @@ ansible-galaxy install ANXS.postgresql
2020

2121
#### Example Playbook
2222

23-
Including an example of how to use your role:
23+
An example how to include this role:
2424

25-
- hosts: postgresql-server
25+
```yml
26+
---
27+
- hosts: postgresql-server
28+
roles:
29+
- role: ANXS.postgresql
2630
become: yes
27-
roles:
28-
- { role: anxs.postgresql }
31+
```
32+
33+
An example how to include this role as a task:
34+
35+
```yml
36+
---
37+
- hosts: postgresql-server
38+
tasks:
39+
- block: # workaround, see https://stackoverflow.com/a/56558842
40+
- name: PSQL installation and configuration
41+
include_role:
42+
name: ANXS.postgresql
43+
vars:
44+
postgresql_users:
45+
- name: abc
46+
password: abc
47+
become: true
48+
```
2949
3050
#### Dependencies
3151
@@ -34,16 +54,13 @@ Including an example of how to use your role:
3454

3555
#### Compatibility matrix
3656

37-
| Distribution / PostgreSQL | <= 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 |
38-
| ------------------------- |:---:|:---:|:---:|:---:|:--:|:--:|:--:|
39-
| Ubuntu 14.04 | :no_entry: | :no_entry:| :no_entry:| :no_entry:| :no_entry:| :no_entry:| :no_entry:|
40-
| Ubuntu 16.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
41-
| Debian 8.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
42-
| Debian 9.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
43-
| CentOS 6.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
44-
| CentOS 7.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:|
45-
| CentOS 8.x | :no_entry: | :grey_question:| :grey_question:| :grey_question:| :grey_question:| :grey_question:| :grey_question:|
46-
| Fedora latest | :no_entry: | :x:| :x:| :x:| :x:| :x:| :x:|
57+
| Distribution / PostgreSQL | 9.5 | 9.6 | 10 | 11 | 12 | 13 |
58+
| ------------------------- |:---:|:---:|:--:|:--:|:--:|:--:|
59+
| Debian 8.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:no_entry: |
60+
| Debian 9.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:no_entry: |
61+
| CentOS 7.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:no_entry: |
62+
| CentOS 8.x | :grey_question: | :grey_question: | :grey_question: | :grey_question: | :grey_question: | :no_entry: |
63+
| Fedora latest | :x: | :x: | :x: | :x: | :x: | :x: |
4764

4865
- :white_check_mark: - tested, works fine
4966
- :warning: - Not for production use
@@ -79,6 +96,7 @@ postgresql_databases:
7996
uuid_ossp: yes # flag to install the uuid-ossp extension on this database (yes/no)
8097
citext: yes # flag to install the citext extension on this database (yes/no)
8198
encoding: "UTF-8" # override global {{ postgresql_encoding }} variable per database
99+
state: "present" # optional; one of 'present', 'absent', 'dump', 'restore'
82100
lc_collate: "en_GB.UTF-8" # override global {{ postgresql_locale }} variable per database
83101
lc_ctype: "en_GB.UTF-8" # override global {{ postgresql_ctype }} variable per database
84102
@@ -93,7 +111,8 @@ postgresql_database_extensions:
93111
postgresql_users:
94112
- name: baz
95113
pass: pass
96-
encrypted: yes # if password should be encrypted, postgresql >= 10 does only accepts encrypted passwords, ansible module default
114+
encrypted: yes # if password should be encrypted, postgresql >= 10 does only accepts encrypted passwords
115+
state: "present" # optional; one of 'present', 'absent'
97116
98117
# List of schemas to be created (optional)
99118
postgresql_database_schemas:

Vagrantfile

+20-33
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,24 @@ Vagrant.configure('2') do |config|
77
config.ssh.insert_key = false
88
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'
99

10-
config.vm.define 'ubuntu16.local' do |machine|
11-
12-
machine.vm.box = "bento/ubuntu-16.04"
13-
machine.vm.network :private_network, ip: '192.168.88.10'
14-
machine.vm.hostname = 'ubuntu16.local'
15-
16-
machine.vm.provision 'ansible' do |ansible|
17-
ansible.playbook = 'tests/playbook.yml'
18-
ansible.verbose = "vvv"
19-
ansible.become = true
20-
ansible.inventory_path = 'vagrant-inventory'
21-
ansible.host_key_checking = false
22-
end
23-
24-
end
10+
#
11+
# DISABLED
12+
#
13+
# config.vm.define 'ubuntu16.local' do |machine|
14+
#
15+
# machine.vm.box = "bento/ubuntu-16.04"
16+
# machine.vm.network :private_network, ip: '192.168.88.10'
17+
# machine.vm.hostname = 'ubuntu16.local'
18+
#
19+
# machine.vm.provision 'ansible' do |ansible|
20+
# ansible.playbook = 'tests/playbook.yml'
21+
# ansible.verbose = "vvv"
22+
# ansible.become = true
23+
# ansible.inventory_path = 'vagrant-inventory'
24+
# ansible.host_key_checking = false
25+
# end
26+
#
27+
# end
2528

2629
config.vm.define 'jessie64.local' do |machine|
2730

@@ -55,26 +58,10 @@ Vagrant.configure('2') do |config|
5558

5659
end
5760

58-
config.vm.define 'centos6.local' do |machine|
59-
60-
machine.vm.box = "centos/6"
61-
machine.vm.network :private_network, ip: '192.168.88.30'
62-
machine.vm.hostname = 'centos6.local'
63-
64-
machine.vm.provision 'ansible' do |ansible|
65-
ansible.playbook = 'tests/playbook.yml'
66-
ansible.verbose = "vvv"
67-
ansible.become = true
68-
ansible.inventory_path = 'vagrant-inventory'
69-
ansible.host_key_checking = false
70-
end
71-
72-
end
73-
7461
config.vm.define 'centos7.local' do |machine|
7562

7663
machine.vm.box = "centos/7"
77-
machine.vm.network :private_network, ip: '192.168.88.31'
64+
machine.vm.network :private_network, ip: '192.168.88.30'
7865
machine.vm.hostname = 'centos7.local'
7966

8067
machine.vm.provision 'ansible' do |ansible|
@@ -106,4 +93,4 @@ Vagrant.configure('2') do |config|
10693
##
10794
## end
10895

109-
end
96+
end

defaults/main.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ postgresql_ssl_prefer_server_ciphers: on
140140
postgresql_ssl_ecdh_curve: "prime256v1"
141141
postgresql_ssl_min_protocol_version: "TLSv1" # (>= 12)
142142
postgresql_ssl_max_protocol_version: "" # (>= 12)
143-
postgresql_ssl_dh_params_file: "" # (>= 10)
143+
postgresql_ssl_dh_params_file: "" # (>= 10)
144144
postgresql_ssl_passphrase_command: "" # (>= 11)
145145
postgresql_ssl_passphrase_command_supports_reload: off # (>= 11)
146146
postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations
@@ -280,7 +280,6 @@ postgresql_commit_siblings: 5 # range 1-1000
280280

281281
# - Checkpoints -
282282

283-
postgresql_checkpoint_segments: 3 # (<= 9.4) in logfile segments, min 1, 16MB each
284283
postgresql_max_wal_size: 1GB # (>= 9.5)
285284
postgresql_min_wal_size: 80MB # (>= 9.5)
286285
postgresql_checkpoint_flush_after: 0 # (>= 9.6) 0 disables,
@@ -372,7 +371,7 @@ postgresql_wal_receiver_timeout: 60s
372371
# time to wait before retrying to retrieve WAL after a failed attempt
373372
postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5)
374373

375-
# - Subscribers - (>= 10)
374+
# - Subscribers - (>= 10)
376375

377376
# These settings are ignored on a publisher.
378377

meta/main.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ galaxy_info:
1212
versions:
1313
- jessie
1414
- stretch
15-
- name: Ubuntu
16-
versions:
17-
- xenial
18-
- bionic
15+
1916
- name: EL
2017
versions:
2118
- 6
2219
- 7
2320
#
2421
# DISABLED
2522
#
23+
# - name: Ubuntu
24+
# versions:
25+
# - xenial
26+
# - bionic
2627
# - name: Fedora
2728
# versions:
2829
# - 27
@@ -35,9 +36,9 @@ galaxy_info:
3536
- sql
3637
- postgis
3738
- debian
38-
- ubuntu
3939
- centos
4040
- redhat
4141
- fedora
42+
- ubuntu
4243

4344
dependencies: []

tasks/databases.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
lc_ctype: "{{ item.lc_ctype | default(postgresql_ctype) }}"
1515
port: "{{postgresql_port}}"
1616
template: "template0"
17-
state: present
17+
state: "{{ item.state | default('present') }}"
1818
login_user: "{{postgresql_admin_user}}"
1919
become: yes
2020
become_user: "{{postgresql_admin_user}}"

tasks/users.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
password: "{{ item.pass | default(omit) }}"
1212
encrypted: "{{ item.encrypted | default(omit) }}"
1313
port: "{{postgresql_port}}"
14-
state: present
14+
state: "{{ item.state | default('present') }}"
1515
login_user: "{{postgresql_admin_user}}"
1616
no_log: true
1717
become: yes

templates/postgresql.conf-10.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ ssl_cert_file = '{{postgresql_ssl_cert_file}}' # (change requires restart)
8787
ssl_key_file = '{{postgresql_ssl_key_file}}' # (change requires restart)
8888
ssl_ca_file = '{{postgresql_ssl_ca_file}}' # (change requires restart)
8989
ssl_crl_file = '{{postgresql_ssl_crl_file}}' # (change requires restart)
90-
password_encryption = {{ postgresql_password_encryption }} # md5 or scram-sha-256
90+
password_encryption = {{postgresql_password_encryption}} # md5 or scram-sha-256
9191
db_user_namespace = {{'on' if postgresql_db_user_namespace else 'off'}}
9292
row_security = {{'on' if postgresql_row_security else 'off'}}
9393

templates/postgresql.conf-11.j2

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ tcp_keepalives_count = {{ postgresql_tcp_keepalives_count }} # TCP_KEEPCNT;
8787
# - Authentication -
8888

8989
authentication_timeout = {{ postgresql_authentication_timeout }} # 1s-600s
90-
password_encryption = {{ postgresql_password_encryption }} # md5 or scram-sha-256
90+
password_encryption = {{ postgresql_password_encryption }} # md5 or scram-sha-256
9191
db_user_namespace = {{ 'on' if postgresql_db_user_namespace else 'off' }}
9292

9393
# GSSAPI using Kerberos
@@ -169,7 +169,7 @@ effective_io_concurrency = {{ postgresql_effective_io_concurrency }} # 1-1000;
169169
max_worker_processes = {{ postgresql_max_worker_processes }} # (change requires restart)
170170
max_parallel_maintenance_workers = {{ postgresql_max_parallel_maintenance_workers }} # taken from max_parallel_workers
171171
max_parallel_workers_per_gather = {{ postgresql_max_parallel_workers_per_gather }} # taken from max_parallel_workers
172-
parallel_leader_participation = {{ 'on' if postgresql_parallel_leader_participation else 'off' }}
172+
parallel_leader_participation = {{ 'on' if postgresql_parallel_leader_participation else 'off' }}
173173
max_parallel_workers = {{ postgresql_max_parallel_workers }} # maximum number of max_worker_processes that
174174
# can be used in parallel operations
175175
old_snapshot_threshold = {{ postgresql_old_snapshot_threshold }} # 1min-60d; -1 disables; 0 is immediate
@@ -350,7 +350,7 @@ geqo_seed = {{ postgresql_geqo_seed }} # range 0.0-1.0
350350
default_statistics_target = {{ postgresql_default_statistics_target }} # range 1-10000
351351
constraint_exclusion = {{ postgresql_constraint_exclusion }} # on, off, or partition
352352
cursor_tuple_fraction = {{ postgresql_cursor_tuple_fraction }} # range 0.0-1.0
353-
from_collapse_limit = {{ postgresql_from_collapse_limit }}
353+
from_collapse_limit = {{ postgresql_from_collapse_limit }}
354354
join_collapse_limit = {{ postgresql_join_collapse_limit }} # 1 disables collapsing of explicit
355355
# JOIN clauses
356356
force_parallel_mode = {{ 'on' if ( postgresql_force_parallel_mode | bool == true or postgresql_force_parallel_mode == 'on' ) else ( 'regress' if postgresql_force_parallel_mode == 'regress' else 'off' ) }}

templates/postgresql.conf-12.j2

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ tcp_user_timeout = {{ postgresql_tcp_user_timeout }} # TCP_USE
8989
# - Authentication -
9090

9191
authentication_timeout = {{ postgresql_authentication_timeout }} # 1s-600s
92-
password_encryption = {{ postgresql_password_encryption }} # md5 or scram-sha-256
92+
password_encryption = {{ postgresql_password_encryption }} # md5 or scram-sha-256
9393
db_user_namespace = {{ 'on' if postgresql_db_user_namespace else 'off' }}
9494

9595
# GSSAPI using Kerberos
@@ -178,7 +178,7 @@ effective_io_concurrency = {{ postgresql_effective_io_concurrency }} # 1-1000;
178178
max_worker_processes = {{ postgresql_max_worker_processes }} # (change requires restart)
179179
max_parallel_maintenance_workers = {{ postgresql_max_parallel_maintenance_workers }} # taken from max_parallel_workers
180180
max_parallel_workers_per_gather = {{ postgresql_max_parallel_workers_per_gather }} # taken from max_parallel_workers
181-
parallel_leader_participation = {{ 'on' if postgresql_parallel_leader_participation else 'off' }}
181+
parallel_leader_participation = {{ 'on' if postgresql_parallel_leader_participation else 'off' }}
182182
max_parallel_workers = {{ postgresql_max_parallel_workers }} # maximum number of max_worker_processes that
183183
# can be used in parallel operations
184184
old_snapshot_threshold = {{ postgresql_old_snapshot_threshold }} # 1min-60d; -1 disables; 0 is immediate
@@ -403,7 +403,7 @@ geqo_seed = {{ postgresql_geqo_seed }} # range 0.0-1.0
403403
default_statistics_target = {{ postgresql_default_statistics_target }} # range 1-10000
404404
constraint_exclusion = {{ postgresql_constraint_exclusion }} # on, off, or partition
405405
cursor_tuple_fraction = {{ postgresql_cursor_tuple_fraction }} # range 0.0-1.0
406-
from_collapse_limit = {{ postgresql_from_collapse_limit }}
406+
from_collapse_limit = {{ postgresql_from_collapse_limit }}
407407
join_collapse_limit = {{ postgresql_join_collapse_limit }} # 1 disables collapsing of explicit
408408
# JOIN clauses
409409
force_parallel_mode = {{ 'on' if ( postgresql_force_parallel_mode | bool == true or postgresql_force_parallel_mode == 'on' ) else ( 'regress' if postgresql_force_parallel_mode == 'regress' else 'off' ) }}

0 commit comments

Comments
 (0)