author | Luke Hoersten <luke@hoersten.org> |
Thu, 20 Jul 2023 18:07:44 -0500 | |
changeset 214 | 3069b7d001f7 |
parent 212 | afd4595fe1af |
child 215 | dd52907adff9 |
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: |
211 | 47 |
- {"src": "dendrite" , "dest": "dendrite"} |
48 |
- {"src": "create-account" , "dest": "dendrite-create-account"} |
|
49 |
- {"src": "dendrite-upgrade-tests" , "dest": "dendrite-upgrade-tests"} |
|
50 |
- {"src": "generate-config" , "dest": "dendrite-generate-config"} |
|
51 |
- {"src": "generate-keys" , "dest": "dendrite-generate-keys"} |
|
52 |
- {"src": "resolve-state" , "dest": "dendrite-resolve-state"} |
|
17 | 53 |
|
51 | 54 |
- name: create instance dir |
17 | 55 |
become: yes |
56 |
file: |
|
51 | 57 |
path: "{{item}}" |
17 | 58 |
state: "directory" |
163 | 59 |
owner: "{{dendrite_user}}" |
60 |
group: "{{dendrite_user}}" |
|
17 | 61 |
mode: "0755" |
169
f4f9b52ede46
Fixed dendrite restart handler bug.
Luke Hoersten <luke@hoersten.org>
parents:
168
diff
changeset
|
62 |
notify: restart service |
51 | 63 |
loop: |
163 | 64 |
- "{{dendrite_dir}}" |
65 |
- "{{dendrite_dir}}/{{dendrite_instance}}" |
|
17 | 66 |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
67 |
- name: create instance port symlink |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
68 |
become: yes |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
69 |
file: |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
70 |
src: "{{dendrite_dir}}/{{dendrite_instance}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
71 |
dest: "{{dendrite_dir}}/{{dendrite_port}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
72 |
state: "link" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
73 |
owner: "{{dendrite_user}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
74 |
group: "{{dendrite_user}}" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
75 |
mode: "0755" |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
76 |
notify: restart service |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
77 |
|
163 | 78 |
- name: install keys |
17 | 79 |
become: yes |
80 |
copy: |
|
163 | 81 |
src: "{{item}}" |
82 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/" |
|
83 |
owner: "{{dendrite_user}}" |
|
84 |
group: "{{dendrite_user}}" |
|
85 |
mode: "0600" |
|
86 |
loop: "{{dendrite_keys}}" |
|
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
87 |
|
163 | 88 |
- name: copy db schema file |
17 | 89 |
become: yes |
90 |
template: |
|
163 | 91 |
src: "setup_db.psql.j2" |
92 |
dest: "/tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
93 |
owner: "postgres" |
|
94 |
group: "postgres" |
|
95 |
mode: "0600" |
|
17 | 96 |
|
163 | 97 |
- name: install db schema psql |
98 |
become: yes |
|
99 |
become_user: "postgres" |
|
100 |
command: "psql -f /tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
101 |
changed_when: false |
|
17 | 102 |
|
163 | 103 |
- name: configure dendrite |
17 | 104 |
become: yes |
163 | 105 |
template: |
106 |
src: "dendrite.yaml.j2" |
|
107 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/dendrite.yaml" |
|
168 | 108 |
mode: "0600" |
163 | 109 |
owner: "{{dendrite_user}}" |
110 |
group: "{{dendrite_user}}" |
|
169
f4f9b52ede46
Fixed dendrite restart handler bug.
Luke Hoersten <luke@hoersten.org>
parents:
168
diff
changeset
|
111 |
notify: restart service |
17 | 112 |
|
113 |
- name: install systemd service |
|
114 |
become: yes |
|
115 |
template: |
|
163 | 116 |
src: "[email protected]" |
117 |
dest: "/lib/systemd/system/[email protected]" |
|
186
c48761176ede
Minor version updates and bug fixes.
Luke Hoersten <luke@hoersten.org>
parents:
183
diff
changeset
|
118 |
notify: restart service |
17 | 119 |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
120 |
- name: ensure instance service is stopped |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
121 |
become: yes |
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
122 |
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
|
123 |
|
17 | 124 |
- name: ensure service is started |
125 |
become: yes |
|
183
b31ef0e10cad
Added Dendrite symlink to port workaround.
Luke Hoersten <luke@hoersten.org>
parents:
180
diff
changeset
|
126 |
systemd: name="dendrite@{{dendrite_port}}.service" enabled="yes" state="started" |