|
1 | 1 | --- |
2 | 2 | - name: Test PostgreSQL server with ssl support using certificate role |
3 | 3 | hosts: all |
4 | | - |
5 | 4 | tasks: |
6 | | - - name: Test PostgreSQL server with certificate in non default path |
7 | | - block: |
8 | | - - name: Deploy postgresql |
9 | | - include_role: |
10 | | - name: linux-system-roles.postgresql |
11 | | - vars: |
12 | | - postgresql_certificates: |
13 | | - - name: /tmp/tmp_cert |
14 | | - dns: www.example.com |
15 | | - ca: self-sign |
16 | | - postgresql_ssl_enable: yes |
17 | | - |
18 | | - - meta: flush_handlers |
19 | | - |
20 | | - - name: Gather output of psql |
21 | | - environment: |
22 | | - PGPASSWORD: "{{ postgresql_password }}" |
23 | | - shell: | |
24 | | - set -euo pipefail |
25 | | - echo "\conninfo" | psql -U postgres -h 127.0.0.1 |
26 | | - register: result |
27 | | - changed_when: false |
28 | | - |
29 | | - - name: Check output of psql |
30 | | - assert: |
31 | | - that: > |
32 | | - "SSL connection" in result.stdout |
33 | | -
|
34 | | - vars: |
35 | | - postgresql_password: redhat |
36 | | - postgresql_pg_hba_conf: |
37 | | - - type: hostssl |
38 | | - database: all |
39 | | - user: all |
40 | | - auth_method: md5 |
41 | | - address: '127.0.0.1/32' |
42 | | - postgresql_ssl_enable: yes |
43 | | - always: |
44 | | - - name: Clean up |
45 | | - include_tasks: clean_instance.yml |
46 | | - |
47 | 5 | - name: Test PostgreSQL server with certificate in default path |
48 | 6 | block: |
49 | 7 | - name: Deploy postgresql |
|
55 | 13 | dns: www.example.com |
56 | 14 | ca: self-sign |
57 | 15 | postgresql_ssl_enable: yes |
58 | | - |
59 | | - - meta: flush_handlers |
60 | | - |
61 | | - - name: Gather output of psql |
62 | | - environment: |
63 | | - PGPASSWORD: "{{ postgresql_password }}" |
64 | | - shell: | |
65 | | - set -euo pipefail |
66 | | - echo "\conninfo" | psql -U postgres -h 127.0.0.1 |
67 | | - register: result |
68 | | - changed_when: false |
69 | | - |
70 | | - - name: Check output of psql |
71 | | - assert: |
72 | | - that: > |
73 | | - "SSL connection" in result.stdout |
74 | | -
|
75 | | - vars: |
76 | | - postgresql_password: redhat |
77 | | - postgresql_pg_hba_conf: |
78 | | - - type: hostssl |
79 | | - database: all |
80 | | - user: all |
81 | | - auth_method: md5 |
82 | | - address: '127.0.0.1/32' |
83 | | - postgresql_ssl_enable: yes |
84 | | - |
85 | | - always: |
86 | | - - name: Clean up |
87 | | - include_tasks: clean_instance.yml |
88 | | - |
89 | | - - name: Test using own certificate with path specificated in variable |
90 | | - vars: |
91 | | - postgresql_password: redhat |
92 | | - block: |
93 | | - - name: Generate own certificate |
94 | | - include_role: |
95 | | - name: fedora.linux_system_roles.certificate |
96 | | - vars: |
97 | | - certificate_requests: |
98 | | - - name: /tmp/test_cert |
99 | | - dns: www.example.com |
100 | | - ca: self-sign |
101 | | - |
102 | | - - name: Set up database server |
103 | | - include_role: |
104 | | - name: linux-system-roles.postgresql |
105 | | - vars: |
106 | | - postgresql_cert_name: "/tmp/test_cert" |
107 | 16 | postgresql_pg_hba_conf: |
108 | 17 | - type: hostssl |
109 | 18 | database: all |
110 | 19 | user: all |
111 | 20 | auth_method: md5 |
112 | 21 | address: '127.0.0.1/32' |
113 | | - postgresql_ssl_enable: yes |
114 | 22 |
|
115 | 23 | - meta: flush_handlers |
116 | 24 |
|
|
128 | 36 | that: > |
129 | 37 | "SSL connection" in result.stdout |
130 | 38 |
|
| 39 | + vars: |
| 40 | + postgresql_password: redhat |
| 41 | + |
131 | 42 | always: |
| 43 | + - name: Stop tracking certificate |
| 44 | + command: getcert stop-tracking -f test_crt |
| 45 | + changed_when: false |
| 46 | + |
132 | 47 | - name: Clean up |
133 | 48 | include_tasks: clean_instance.yml |
0 commit comments