|
165 | 165 | loop_control: |
166 | 166 | loop_var: 'pg_config_item' |
167 | 167 |
|
168 | | -- name: Allow adminapi to write custom config |
169 | | - file: |
170 | | - path: '{{ item }}' |
171 | | - recurse: yes |
172 | | - state: directory |
173 | | - owner: postgres |
174 | | - group: postgres |
175 | | - mode: 0775 |
176 | | - with_items: |
177 | | - - '/etc/postgresql' |
178 | | - - '/etc/postgresql-custom' |
179 | | - - '/etc/postgresql-custom/conf.d' |
180 | | - when: debpkg_mode or nixpkg_mode |
181 | | - |
182 | | -- name: create placeholder config files |
183 | | - file: |
184 | | - path: '/etc/postgresql-custom/{{ item }}' |
185 | | - state: touch |
186 | | - owner: postgres |
187 | | - group: postgres |
188 | | - mode: 0664 |
189 | | - with_items: |
190 | | - - 'generated-optimizations.conf' |
191 | | - - 'custom-overrides.conf' |
192 | | - when: debpkg_mode or nixpkg_mode |
193 | | - |
194 | | -# Move Postgres configuration files into /etc/postgresql |
195 | | -# Add postgresql.conf |
196 | | -- name: import postgresql.conf |
197 | | - template: |
198 | | - src: files/postgresql_config/postgresql.conf.j2 |
199 | | - dest: /etc/postgresql/postgresql.conf |
200 | | - group: postgres |
201 | | - when: debpkg_mode or nixpkg_mode |
202 | | - |
203 | | -# Add pg_hba.conf |
204 | | -- name: import pg_hba.conf |
205 | | - template: |
206 | | - src: files/postgresql_config/pg_hba.conf.j2 |
207 | | - dest: /etc/postgresql/pg_hba.conf |
208 | | - group: postgres |
209 | | - when: debpkg_mode or nixpkg_mode |
210 | | - |
211 | | -# Add pg_ident.conf |
212 | | -- name: import pg_ident.conf |
213 | | - template: |
214 | | - src: files/postgresql_config/pg_ident.conf.j2 |
215 | | - dest: /etc/postgresql/pg_ident.conf |
216 | | - group: postgres |
217 | | - when: debpkg_mode or nixpkg_mode |
218 | | - |
219 | | -# Add custom config for read replicas set up |
220 | | -- name: Move custom read-replica.conf file to /etc/postgresql-custom/conf.d/read-replica.conf |
221 | | - ansible.builtin.copy: |
222 | | - src: "files/postgresql_config/conf.d/read-replica.conf" |
223 | | - dest: /etc/postgresql-custom/conf.d/read-replica.conf |
224 | | - mode: 0664 |
225 | | - owner: postgres |
226 | | - group: postgres |
227 | | - when: debpkg_mode or nixpkg_mode |
228 | | - |
229 | | -# Install extensions before init |
230 | | -- name: Install Postgres extensions |
231 | | - ansible.builtin.import_tasks: |
232 | | - file: 'tasks/setup-docker.yml' |
233 | | - when: |
234 | | - - (debpkg_mode or stage2_nix) |
| 168 | + - name: Allow adminapi to write custom config |
| 169 | + ansible.builtin.file: |
| 170 | + group: postgres |
| 171 | + mode: 0775 |
| 172 | + owner: postgres |
| 173 | + path: '{{ item }}' |
| 174 | + recurse: yes |
| 175 | + state: directory |
| 176 | + with_items: |
| 177 | + - '/etc/postgresql' |
| 178 | + - '/etc/postgresql-custom' |
| 179 | + - '/etc/postgresql-custom/conf.d' |
| 180 | + |
| 181 | + - name: create placeholder config files |
| 182 | + ansible.builtin.file: |
| 183 | + group: postgres |
| 184 | + mode: 0664 |
| 185 | + owner: postgres |
| 186 | + path: '/etc/postgresql-custom/{{ item }}' |
| 187 | + state: touch |
| 188 | + with_items: |
| 189 | + - 'generated-optimizations.conf' |
| 190 | + - 'custom-overrides.conf' |
| 191 | + |
| 192 | + - name: import postgresql.conf |
| 193 | + ansible.builtin.template: |
| 194 | + dest: /etc/postgresql/postgresql.conf |
| 195 | + group: postgres |
| 196 | + src: files/postgresql_config/postgresql.conf.j2 |
| 197 | + |
| 198 | + - name: import pg_hba.conf |
| 199 | + ansible.builtin.template: |
| 200 | + dest: /etc/postgresql/pg_hba.conf |
| 201 | + group: postgres |
| 202 | + src: files/postgresql_config/pg_hba.conf.j2 |
| 203 | + |
| 204 | + - name: import pg_ident.conf |
| 205 | + ansible.builtin.template: |
| 206 | + dest: /etc/postgresql/pg_ident.conf |
| 207 | + group: postgres |
| 208 | + src: files/postgresql_config/pg_ident.conf.j2 |
| 209 | + |
| 210 | + - name: Move custom read-replica.conf file to /etc/postgresql-custom/conf.d/read-replica.conf |
| 211 | + ansible.builtin.copy: |
| 212 | + dest: /etc/postgresql-custom/conf.d/read-replica.conf |
| 213 | + group: postgres |
| 214 | + mode: 0664 |
| 215 | + owner: postgres |
| 216 | + src: "files/postgresql_config/conf.d/read-replica.conf" |
| 217 | + |
| 218 | + - name: Install Postgres extensions |
| 219 | + ansible.builtin.import_tasks: |
| 220 | + file: 'tasks/setup-docker.yml' |
235 | 221 |
|
236 | 222 | #stage 2 postgres tasks |
237 | 223 | - name: stage2 postgres tasks |
|
271 | 257 | - initdb |
272 | 258 | - -o "--allow-group-access" |
273 | 259 | - -o "--username=supabase_admin" |
274 | | - - -o "-D /var/lib/postgresql/data" |
| 260 | + - -o "-D /data/pgdata" |
275 | 261 | args: |
276 | | - creates: /var/lib/postgresql/data/PG_VERSION |
| 262 | + creates: /data/pgdata/PG_VERSION |
277 | 263 | vars: |
278 | 264 | ansible_command_timeout: 60 |
279 | 265 | when: |
|
307 | 293 | - initdb |
308 | 294 | - -o "--allow-group-access" |
309 | 295 | - -o "--username=supabase_admin" |
310 | | - - -o "-D /var/lib/postgresql/data" |
| 296 | + - -o "-D /data/pgdata" |
311 | 297 | args: |
312 | | - creates: /var/lib/postgresql/data/PG_VERSION |
| 298 | + creates: /data/pgdata/PG_VERSION |
313 | 299 | environment: |
314 | 300 | LANG: en_US.UTF-8 |
315 | 301 | LANGUAGE: en_US.UTF-8 |
|
335 | 321 | - -o "--locale-provider=icu" |
336 | 322 | - -o "--encoding=UTF-8" |
337 | 323 | - -o "--icu-locale=en_US.UTF-8" |
338 | | - - -o "-D /var/lib/postgresql/data" |
| 324 | + - -o "-D /data/pgdata" |
339 | 325 | args: |
340 | | - creates: /var/lib/postgresql/data/PG_VERSION |
| 326 | + creates: /data/pgdata/PG_VERSION |
341 | 327 | environment: |
342 | 328 | LANG: en_US.UTF-8 |
343 | 329 | LANGUAGE: en_US.UTF-8 |
|
0 commit comments