|
167 | 167 | loop_control: |
168 | 168 | loop_var: 'pg_config_item' |
169 | 169 |
|
170 | | -- name: Allow adminapi to write custom config |
171 | | - file: |
172 | | - path: '{{ item }}' |
173 | | - recurse: yes |
174 | | - state: directory |
175 | | - owner: postgres |
176 | | - group: postgres |
177 | | - mode: 0775 |
178 | | - with_items: |
179 | | - - '/etc/postgresql' |
180 | | - - '/etc/postgresql-custom' |
181 | | - when: debpkg_mode or nixpkg_mode |
182 | | - |
183 | | -- name: create placeholder config files |
184 | | - file: |
185 | | - path: '/etc/postgresql-custom/{{ item }}' |
186 | | - state: touch |
187 | | - owner: postgres |
188 | | - group: postgres |
189 | | - mode: 0664 |
190 | | - with_items: |
191 | | - - '01-generated-optimizations.conf' |
192 | | - - '02-custom-overrides.conf' |
193 | | - when: debpkg_mode or nixpkg_mode |
194 | | - |
195 | | -# Move Postgres configuration files into /etc/postgresql |
196 | | -# Add postgresql.conf |
197 | | -- name: import postgresql.conf |
198 | | - template: |
199 | | - src: files/postgresql_config/postgresql.conf.j2 |
200 | | - dest: /etc/postgresql/postgresql.conf |
201 | | - group: postgres |
202 | | - when: debpkg_mode or nixpkg_mode |
203 | | - |
204 | | -- name: Check if psql_version is psql_15 |
205 | | - set_fact: |
206 | | - is_psql_15: "{{ psql_version in ['psql_15'] }}" |
207 | | - |
208 | | -- name: create placeholder pam config |
209 | | - file: |
210 | | - path: '/etc/pam.d/postgresql' |
211 | | - state: touch |
212 | | - owner: postgres |
213 | | - group: postgres |
214 | | - mode: 0664 |
215 | | - when: (debpkg_mode or nixpkg_mode) and not is_psql_15 |
216 | | - |
217 | | -# Add pg_hba.conf |
218 | | -- name: import pg_hba.conf |
219 | | - template: |
220 | | - src: files/postgresql_config/pg_hba.conf.j2 |
221 | | - dest: /etc/postgresql/pg_hba.conf |
222 | | - group: postgres |
223 | | - when: debpkg_mode or nixpkg_mode |
224 | | - |
225 | | -# Add pg_ident.conf |
226 | | -- name: import pg_ident.conf |
227 | | - template: |
228 | | - src: files/postgresql_config/pg_ident.conf.j2 |
229 | | - dest: /etc/postgresql/pg_ident.conf |
230 | | - group: postgres |
231 | | - when: debpkg_mode or nixpkg_mode |
232 | | - |
233 | | -# Add custom config for read replicas set up |
234 | | -- name: Move custom read-replica.conf file to /etc/postgresql-custom/04-read-replica.conf |
235 | | - template: |
236 | | - src: "files/postgresql_config/custom_read_replica.conf.j2" |
237 | | - dest: /etc/postgresql-custom/04-read-replica.conf |
238 | | - mode: 0664 |
239 | | - owner: postgres |
240 | | - group: postgres |
241 | | - when: debpkg_mode or nixpkg_mode |
| 170 | + - name: Move custom read-replica.conf file to /etc/postgresql-custom/read-replica.conf |
| 171 | + ansible.builtin.template: |
| 172 | + dest: '/etc/postgresql-custom/read-replica.conf' |
| 173 | + mode: '0664' |
| 174 | + owner: 'postgres' |
| 175 | + group: 'postgres' |
| 176 | + src: 'files/postgresql_config/custom_read_replica.conf.j2' |
| 177 | + |
| 178 | + - name: Check if psql_version is psql_15 |
| 179 | + set_fact: |
| 180 | + is_psql_15: "{{ psql_version in ['psql_15'] }}" |
| 181 | + |
| 182 | + - name: create placeholder pam config |
| 183 | + file: |
| 184 | + path: '/etc/pam.d/postgresql' |
| 185 | + state: touch |
| 186 | + owner: postgres |
| 187 | + group: postgres |
| 188 | + mode: 0664 |
| 189 | + when: not is_psql_15 |
242 | 190 |
|
243 | 191 | # Install extensions before init |
244 | 192 | - name: Install Postgres extensions |
|
0 commit comments