author | Luke Hoersten <luke@hoersten.org> |
Sat, 11 Feb 2023 10:49:06 -0600 | |
changeset 209 | 81014d20e5b1 |
parent 186 | c48761176ede |
child 211 | 9e2b2cc6ccf1 |
permissions | -rw-r--r-- |
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
1 |
--- |
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
2 |
|
163 | 3 |
- name: add dendrite user |
17 | 4 |
become: yes |
174 | 5 |
user: name="{{dendrite_user}}" shell="/bin/false" system="yes" |
17 | 6 |
|
163 | 7 |
# build |
8 |
- name: snap install golang |
|
9 |
become: yes |
|
10 |
snap: name="go" classic="yes" |
|
11 |
||
12 |
- name: unarchive dendrite |
|
17 | 13 |
become: yes |
14 |
unarchive: |
|
15 |
remote_src: yes |
|
163 | 16 |
src: "{{dendrite_tar}}" |
17 | 17 |
dest: "/tmp/" |
163 | 18 |
creates: "{{dendrite_build_dir}}" |
19 |
owner: "{{dendrite_user}}" |
|
20 |
group: "{{dendrite_user}}" |
|
21 |
||
22 |
- name: check if dendrite build exists |
|
23 |
stat: |
|
24 |
path: "{{dendrite_build_dir}}/bin" |
|
25 |
register: build_file |
|
26 |
||
27 |
- name: build dendrite |
|
28 |
become: yes |
|
29 |
become_user: "{{dendrite_user}}" |
|
30 |
command: "{{dendrite_build_dir}}/build.sh" |
|
31 |
args: |
|
32 |
chdir: "{{dendrite_build_dir}}" |
|
33 |
when: not build_file.stat.exists |
|
34 |
notify: restart service |
|
35 |
||
36 |
# install |
|
37 |
- name: install dendrite binary |
|
38 |
become: yes |
|
39 |
copy: |
|
180 | 40 |
src: "{{dendrite_build_dir}}/bin/{{item.src}}" |
41 |
dest: "/usr/local/bin/{{item.dest}}" |
|
163 | 42 |
remote_src: yes |
17 | 43 |
owner: "root" |
44 |
group: "root" |
|
18
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
45 |
mode: "0755" |
180 | 46 |
loop: |
47 |
- {"src": "dendrite-monolith-server" , "dest": "dendrite-monolith-server"} |
|
48 |
- {"src": "create-account" , "dest": "dendrite-create-account"} |
|
49 |
- {"src": "dendrite-polylith-multi" , "dest": "dendrite-polylith-multi"} |
|
50 |
- {"src": "dendrite-upgrade-tests" , "dest": "dendrite-upgrade-tests"} |
|
51 |
- {"src": "generate-config" , "dest": "dendrite-generate-config"} |
|
52 |
- {"src": "generate-keys" , "dest": "dendrite-generate-keys"} |
|
53 |
- {"src": "resolve-state" , "dest": "dendrite-resolve-state"} |
|
17 | 54 |
|
51 | 55 |
- name: create instance dir |
17 | 56 |
become: yes |
57 |
file: |
|
51 | 58 |
path: "{{item}}" |
17 | 59 |
state: "directory" |
163 | 60 |
owner: "{{dendrite_user}}" |
61 |
group: "{{dendrite_user}}" |
|
17 | 62 |
mode: "0755" |
169
f4f9b52ede46
Fixed dendrite restart handler bug.
Luke Hoersten <luke@hoersten.org>
parents:
168
diff
changeset
|
63 |
notify: restart service |
51 | 64 |
loop: |
163 | 65 |
- "{{dendrite_dir}}" |
66 |
- "{{dendrite_dir}}/{{dendrite_instance}}" |
|
17 | 67 |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
68 |
- name: create instance port symlink |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
69 |
become: yes |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
70 |
file: |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
71 |
src: "{{dendrite_dir}}/{{dendrite_instance}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
72 |
dest: "{{dendrite_dir}}/{{dendrite_port}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
73 |
state: "link" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
74 |
owner: "{{dendrite_user}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
75 |
group: "{{dendrite_user}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
76 |
mode: "0755" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
77 |
notify: restart service |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
78 |
|
163 | 79 |
- name: install keys |
17 | 80 |
become: yes |
81 |
copy: |
|
163 | 82 |
src: "{{item}}" |
83 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/" |
|
84 |
owner: "{{dendrite_user}}" |
|
85 |
group: "{{dendrite_user}}" |
|
86 |
mode: "0600" |
|
87 |
loop: "{{dendrite_keys}}" |
|
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
88 |
|
163 | 89 |
- name: copy db schema file |
17 | 90 |
become: yes |
91 |
template: |
|
163 | 92 |
src: "setup_db.psql.j2" |
93 |
dest: "/tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
94 |
owner: "postgres" |
|
95 |
group: "postgres" |
|
96 |
mode: "0600" |
|
17 | 97 |
|
163 | 98 |
- name: install db schema psql |
99 |
become: yes |
|
100 |
become_user: "postgres" |
|
101 |
command: "psql -f /tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
102 |
changed_when: false |
|
17 | 103 |
|
163 | 104 |
- name: configure dendrite |
17 | 105 |
become: yes |
163 | 106 |
template: |
107 |
src: "dendrite.yaml.j2" |
|
108 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/dendrite.yaml" |
|
168 | 109 |
mode: "0600" |
163 | 110 |
owner: "{{dendrite_user}}" |
111 |
group: "{{dendrite_user}}" |
|
169
f4f9b52ede46
Fixed dendrite restart handler bug.
Luke Hoersten <luke@hoersten.org>
parents:
168
diff
changeset
|
112 |
notify: restart service |
17 | 113 |
|
114 |
- name: install systemd service |
|
115 |
become: yes |
|
116 |
template: |
|
163 | 117 |
src: "[email protected]" |
118 |
dest: "/lib/systemd/system/[email protected]" |
|
186
c48761176ede
Minor version updates and bug fixes.
Luke Hoersten <luke@hoersten.org>
parents:
183
diff
changeset
|
119 |
notify: restart service |
17 | 120 |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
121 |
- name: ensure instance service is stopped |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
122 |
become: yes |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
123 |
systemd: name="dendrite@{{dendrite_instance}}.service" enabled="no" state="stopped" daemon_reload="yes" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
124 |
|
17 | 125 |
- name: ensure service is started |
126 |
become: yes |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
127 |
systemd: name="dendrite@{{dendrite_port}}.service" enabled="yes" state="started" |