author | Luke Hoersten <luke@hoersten.org> |
Mon, 08 Aug 2022 16:12:44 -0500 | |
changeset 182 | b4ce6f1f15b7 |
parent 174 | 431c6d5e5dd4 |
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 |
|
17 | 3 |
- name: add writefreely user |
4 |
become: yes |
|
174 | 5 |
user: name="{{writefreely_user}}" shell="/bin/false" system="yes" create_home="no" |
17 | 6 |
|
7 |
- name: unarchive writefreely |
|
8 |
become: yes |
|
9 |
unarchive: |
|
10 |
remote_src: yes |
|
11 |
src: "{{writefreely_tar}}" |
|
12 |
dest: "/tmp/" |
|
13 |
creates: "/tmp/writefreely/" |
|
14 |
owner: "root" |
|
15 |
group: "root" |
|
16 |
||
17 |
- name: install writefreely binary |
|
18 |
become: yes |
|
18
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
19 |
copy: |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
20 |
src: "/tmp/writefreely/writefreely" |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
21 |
dest: "/usr/local/bin/" |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
22 |
remote_src: yes |
163 | 23 |
owner: "root" |
24 |
group: "root" |
|
18
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
25 |
mode: "0755" |
171 | 26 |
notify: |
27 |
- migrate db |
|
28 |
- restart service |
|
17 | 29 |
|
51 | 30 |
- name: create instance dir |
17 | 31 |
become: yes |
32 |
file: |
|
51 | 33 |
path: "{{item}}" |
17 | 34 |
state: "directory" |
35 |
owner: "{{writefreely_user}}" |
|
36 |
group: "{{writefreely_user}}" |
|
37 |
mode: "0755" |
|
171 | 38 |
notify: restart service |
51 | 39 |
loop: |
40 |
- "{{writefreely_dir}}" |
|
41 |
- "{{writefreely_dir}}/{{writefreely_instance}}" |
|
17 | 42 |
|
43 |
- name: install static content |
|
44 |
become: yes |
|
45 |
copy: |
|
46 |
src: "/tmp/writefreely/" |
|
47 |
remote_src: yes |
|
48 |
dest: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
49 |
owner: "{{writefreely_user}}" |
|
50 |
group: "{{writefreely_user}}" |
|
51 |
mode: "0755" |
|
171 | 52 |
notify: restart service |
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
53 |
|
17 | 54 |
- name: configure |
55 |
become: yes |
|
56 |
template: |
|
57 |
src: "config.ini.j2" |
|
58 |
dest: "{{writefreely_dir}}/{{writefreely_instance}}/config.ini" |
|
59 |
mode: "0644" |
|
60 |
owner: "{{writefreely_user}}" |
|
61 |
group: "{{writefreely_user}}" |
|
171 | 62 |
notify: restart service |
26
b0e4ad2f4291
Fix writefreely role to be idempotent.
Luke Hoersten <luke@hoersten.org>
parents:
18
diff
changeset
|
63 |
|
17 | 64 |
- name: generate keys |
65 |
become: yes |
|
66 |
become_user: "{{writefreely_user}}" |
|
170
a20a6d03747f
Updated versions: minecraft, miniflux, pleroma, writefreely, ergo-oragono.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
67 |
command: "writefreely keys generate" |
17 | 68 |
args: |
69 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
172 | 70 |
changed_when: false |
17 | 71 |
|
72 |
- name: check if db exists |
|
73 |
stat: |
|
74 |
path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db" |
|
75 |
register: db_file |
|
76 |
||
77 |
- name: create db |
|
78 |
become: yes |
|
79 |
become_user: "{{writefreely_user}}" |
|
80 |
command: "writefreely db init" |
|
81 |
args: |
|
82 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
83 |
when: not db_file.stat.exists |
|
84 |
||
85 |
- name: create admin |
|
86 |
become: yes |
|
87 |
become_user: "{{writefreely_user}}" |
|
88 |
command: "writefreely --create-admin admin:admin" |
|
89 |
args: |
|
90 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
91 |
when: not db_file.stat.exists |
|
92 |
||
93 |
- name: install systemd service |
|
94 |
become: yes |
|
95 |
template: |
|
96 |
src: "[email protected]" |
|
97 |
dest: "/lib/systemd/system/[email protected]" |
|
171 | 98 |
notify: reload service |
17 | 99 |
|
100 |
- name: ensure service is started |
|
101 |
become: yes |
|
102 |
systemd: name="writefreely@{{writefreely_instance}}.service" enabled="yes" state="started" |