author | Luke Hoersten <luke@hoersten.org> |
Mon, 07 Sep 2020 15:06:06 -0500 | |
changeset 139 | 4efa743f2fa1 |
parent 122 | cde9702e3bff |
child 141 | 0708c9c075fc |
permissions | -rw-r--r-- |
60 | 1 |
--- |
2 |
||
3 |
- name: add users |
|
4 |
become: yes |
|
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
5 |
user: name="pleroma" shell="/bin/false" home="/opt/pleroma" system="yes" |
60 | 6 |
|
101 | 7 |
- name: apt install pleroma dependencies |
8 |
become: yes |
|
9 |
apt: name="libtinfo5" |
|
10 |
||
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
11 |
- name: create config and data directory |
60 | 12 |
become: yes |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
13 |
file: |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
14 |
path: "{{item}}" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
15 |
state: "directory" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
16 |
mode: "0755" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
17 |
with_items: |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
18 |
- "{{pleroma_data_dir}}" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
19 |
- "/etc/pleroma" |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
20 |
- "/opt/pleroma" |
60 | 21 |
|
81 | 22 |
- name: install pleroma config |
60 | 23 |
template: |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
24 |
src: "config.exs.j2" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
25 |
dest: "/etc/pleroma/{{pleroma_instance}}.config.exs" |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
26 |
owner: "pleroma" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
27 |
group: "pleroma" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
28 |
mode: "0600" |
81 | 29 |
become: yes |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
30 |
notify: restart pleroma instance |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
31 |
|
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
32 |
- name: create instance data directory |
60 | 33 |
become: yes |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
34 |
file: |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
35 |
path: "{{item}}" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
36 |
state: "directory" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
37 |
owner: "pleroma" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
38 |
group: "pleroma" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
39 |
mode: "0755" |
60 | 40 |
with_items: |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
41 |
- "{{pleroma_data_dir}}/{{pleroma_instance}}" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
42 |
- "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
43 |
- "{{pleroma_data_dir}}/{{pleroma_instance}}/static" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
44 |
- "{{pleroma_data_dir}}/{{pleroma_instance}}/static/emoji" |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
45 |
|
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
46 |
- name: install pleroma db schema file |
92
d4924111ce28
Made pleroma roles idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
89
diff
changeset
|
47 |
become: yes |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
48 |
template: |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
49 |
src: "setup_db.psql.j2" |
92
d4924111ce28
Made pleroma roles idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
89
diff
changeset
|
50 |
dest: "/tmp/setup_db_{{pleroma_instance}}.psql" |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
51 |
owner: "{{pleroma_db_superuser}}" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
52 |
group: "{{pleroma_db_superuser}}" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
53 |
mode: "0600" |
60 | 54 |
|
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
55 |
- name: install pleroma psql |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
56 |
become: yes |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
57 |
become_user: "{{pleroma_db_superuser}}" |
92
d4924111ce28
Made pleroma roles idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
89
diff
changeset
|
58 |
command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql" |
d4924111ce28
Made pleroma roles idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
89
diff
changeset
|
59 |
changed_when: false |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
60 |
|
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
61 |
- name: download and unarchive pleroma release |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
62 |
become: yes |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
63 |
unarchive: |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
64 |
src: "{{pleroma_download_url}}" |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
65 |
dest: "/tmp/" |
120
7b3b01948954
Add Soapbox frontend support for Pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
103
diff
changeset
|
66 |
creates: "/tmp/release" |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
67 |
remote_src: yes |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
68 |
notify: restart pleroma instance |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
69 |
|
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
70 |
- name: install pleroma release |
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
71 |
become: yes |
97 | 72 |
copy: |
73 |
remote_src: true |
|
74 |
src: "/tmp/release/" |
|
75 |
dest: "/opt/pleroma/" |
|
76 |
owner: "pleroma" |
|
77 |
group: "pleroma" |
|
98
444887b61044
Made pleroma role idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
97
diff
changeset
|
78 |
changed_when: false |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
79 |
|
122
cde9702e3bff
Fixed resolv.conf in adguard role.
Luke Hoersten <luke@hoersten.org>
parents:
121
diff
changeset
|
80 |
- include_tasks: soapbox.yaml |
120
7b3b01948954
Add Soapbox frontend support for Pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
103
diff
changeset
|
81 |
when: pleroma_soapbox |
7b3b01948954
Add Soapbox frontend support for Pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
103
diff
changeset
|
82 |
|
87
4f87097dd651
Got pleroma otp multi-instance working.
Luke Hoersten <luke@hoersten.org>
parents:
85
diff
changeset
|
83 |
- name: configure pleroma systemd service |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
84 |
become: yes |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
85 |
copy: |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
86 |
src: "[email protected]" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
87 |
dest: "/lib/systemd/system/[email protected]" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
88 |
notify: restart pleroma instance |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
89 |
|
87
4f87097dd651
Got pleroma otp multi-instance working.
Luke Hoersten <luke@hoersten.org>
parents:
85
diff
changeset
|
90 |
- name: ensure pleroma instance is enabled and started |
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
91 |
become: yes |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
92 |
systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started" |
84
d0c40727e6ff
Added WIP pleroma OTP role.
Luke Hoersten <luke@hoersten.org>
parents:
81
diff
changeset
|
93 |
|
85
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
94 |
- name: migrate db |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
95 |
become: yes |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
96 |
become_user: "pleroma" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
97 |
command: "/opt/pleroma/bin/pleroma_ctl migrate" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
98 |
args: |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
99 |
chdir: "/opt/pleroma/" |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
100 |
environment: |
dcfd23308c32
Completed pleroma-otp role.
Luke Hoersten <luke@hoersten.org>
parents:
84
diff
changeset
|
101 |
PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs" |
92
d4924111ce28
Made pleroma roles idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
89
diff
changeset
|
102 |
changed_when: false |