author | Luke Hoersten <luke@hoersten.org> |
Mon, 19 Jul 2021 21:15:42 -0500 | |
changeset 167 | e3c49bf5fae9 |
parent 163 | 40b78af86337 |
child 168 | 8e61e4bb714b |
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 |
163 | 5 |
user: name="{{dendrite_user}}" |
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: |
|
40 |
src: "{{dendrite_build_dir}}/bin/dendrite-monolith-server" |
|
41 |
dest: "/usr/local/bin/dendrite-monolith-server" |
|
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" |
17 | 46 |
|
51 | 47 |
- name: create instance dir |
17 | 48 |
become: yes |
49 |
file: |
|
51 | 50 |
path: "{{item}}" |
17 | 51 |
state: "directory" |
163 | 52 |
owner: "{{dendrite_user}}" |
53 |
group: "{{dendrite_user}}" |
|
17 | 54 |
mode: "0755" |
55 |
notify: reload service |
|
51 | 56 |
loop: |
163 | 57 |
- "{{dendrite_dir}}" |
58 |
- "{{dendrite_dir}}/{{dendrite_instance}}" |
|
17 | 59 |
|
163 | 60 |
- name: install keys |
17 | 61 |
become: yes |
62 |
copy: |
|
163 | 63 |
src: "{{item}}" |
64 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/" |
|
65 |
owner: "{{dendrite_user}}" |
|
66 |
group: "{{dendrite_user}}" |
|
67 |
mode: "0600" |
|
68 |
loop: "{{dendrite_keys}}" |
|
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
69 |
|
163 | 70 |
- name: copy db schema file |
17 | 71 |
become: yes |
72 |
template: |
|
163 | 73 |
src: "setup_db.psql.j2" |
74 |
dest: "/tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
75 |
owner: "postgres" |
|
76 |
group: "postgres" |
|
77 |
mode: "0600" |
|
17 | 78 |
|
163 | 79 |
- name: install db schema psql |
80 |
become: yes |
|
81 |
become_user: "postgres" |
|
82 |
command: "psql -f /tmp/setup_db_dendrite_{{dendrite_instance}}.psql" |
|
83 |
changed_when: false |
|
17 | 84 |
|
163 | 85 |
- name: configure dendrite |
17 | 86 |
become: yes |
163 | 87 |
template: |
88 |
src: "dendrite.yaml.j2" |
|
89 |
dest: "{{dendrite_dir}}/{{dendrite_instance}}/dendrite.yaml" |
|
90 |
mode: "0644" |
|
91 |
owner: "{{dendrite_user}}" |
|
92 |
group: "{{dendrite_user}}" |
|
93 |
notify: reload service |
|
17 | 94 |
|
95 |
- name: install systemd service |
|
96 |
become: yes |
|
97 |
template: |
|
163 | 98 |
src: "[email protected]" |
99 |
dest: "/lib/systemd/system/[email protected]" |
|
17 | 100 |
|
101 |
- name: ensure service is started |
|
102 |
become: yes |
|
163 | 103 |
systemd: name="dendrite@{{dendrite_instance}}.service" enabled="yes" state="started" |