author | Luke Hoersten <luke@hoersten.org> |
Mon, 07 Oct 2024 23:31:51 -0500 | |
changeset 239 | c3e3169399a8 |
parent 227 | 2e0366f2dcbe |
permissions | -rw-r--r-- |
40
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
1 |
--- |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
2 |
|
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
3 |
- name: install postgresql |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
4 |
become: yes |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
5 |
apt: name="{{postgresql_apt_packages}}" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
6 |
|
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
7 |
- name: configure postgresql data dir |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
8 |
become: yes |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
9 |
lineinfile: |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
10 |
path: "{{postgresql_config_path}}" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
11 |
regexp: "^data_directory = " |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
12 |
line: "data_directory = '{{postgresql_data_dir}}'" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
13 |
notify: restart postgres |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
14 |
|
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
15 |
- name: create postgresql data dir |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
16 |
become: yes |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
17 |
file: |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
18 |
path: "{{postgresql_data_dir}}" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
19 |
state: "directory" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
20 |
mode: "0700" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
21 |
owner: "postgres" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
22 |
group: "postgres" |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
23 |
notify: restart postgres |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
24 |
|
227
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
25 |
- name: check if postgresql data dir is new |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
26 |
become: yes |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
27 |
find: path='{{postgresql_data_dir}}' |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
28 |
register: filesFound |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
29 |
|
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
30 |
- name: initialize pg data dir |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
31 |
become: yes |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
32 |
become_user: "postgres" |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
33 |
command: "{{postgresql_initidb_path}} -D {{postgresql_data_dir}}" |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
34 |
when: filesFound == 0 |
2e0366f2dcbe
Tons of updates to fix migration to new server.
Luke Hoersten <luke@hoersten.org>
parents:
40
diff
changeset
|
35 |
|
40
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
36 |
- name: ensure postgresql is started |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
37 |
become: yes |
b42b417751e5
Moved over postgresql and nginx roles from pleroma roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
38 |
systemd: name="postgresql" enabled="yes" state="started" |