author | Luke Hoersten <luke@hoersten.org> |
Tue, 12 May 2020 21:24:25 -0500 | |
changeset 19 | 31de177274a1 |
parent 18 | ea20908c3904 |
child 26 | b0e4ad2f4291 |
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 |
|
5 |
user: name="{{writefreely_user}}" |
|
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 |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
23 |
owner: "{{writefreely_user}}" |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
24 |
group: "{{writefreely_user}}" |
ea20908c3904
Removed use of install command.
Luke Hoersten <luke@hoersten.org>
parents:
17
diff
changeset
|
25 |
mode: "0755" |
17 | 26 |
|
27 |
- name: create root dir |
|
28 |
become: yes |
|
29 |
file: |
|
30 |
path: "{{writefreely_dir}}" |
|
31 |
state: "directory" |
|
32 |
owner: "{{writefreely_user}}" |
|
33 |
group: "{{writefreely_user}}" |
|
34 |
mode: "0755" |
|
35 |
notify: reload service |
|
36 |
||
37 |
- name: create instance dir |
|
38 |
become: yes |
|
39 |
file: |
|
40 |
path: "{{writefreely_dir}}/{{writefreely_instance}}" |
|
41 |
state: "directory" |
|
42 |
owner: "{{writefreely_user}}" |
|
43 |
group: "{{writefreely_user}}" |
|
44 |
mode: "0755" |
|
45 |
notify: reload service |
|
46 |
||
47 |
- name: install static content |
|
48 |
become: yes |
|
49 |
copy: |
|
50 |
src: "/tmp/writefreely/" |
|
51 |
remote_src: yes |
|
52 |
dest: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
53 |
owner: "{{writefreely_user}}" |
|
54 |
group: "{{writefreely_user}}" |
|
55 |
mode: "0755" |
|
1
fd351734f007
Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
56 |
|
17 | 57 |
- name: configure |
58 |
become: yes |
|
59 |
template: |
|
60 |
src: "config.ini.j2" |
|
61 |
dest: "{{writefreely_dir}}/{{writefreely_instance}}/config.ini" |
|
62 |
mode: "0644" |
|
63 |
owner: "{{writefreely_user}}" |
|
64 |
group: "{{writefreely_user}}" |
|
65 |
notify: reload service |
|
66 |
||
67 |
- name: generate keys |
|
68 |
become: yes |
|
69 |
become_user: "{{writefreely_user}}" |
|
70 |
command: "writefreely keys gen" |
|
71 |
args: |
|
72 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
73 |
||
74 |
- name: check if db exists |
|
75 |
stat: |
|
76 |
path: "{{writefreely_dir}}/{{writefreely_instance}}/writefreely.db" |
|
77 |
register: db_file |
|
78 |
||
79 |
- name: create db |
|
80 |
become: yes |
|
81 |
become_user: "{{writefreely_user}}" |
|
82 |
command: "writefreely db init" |
|
83 |
args: |
|
84 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
85 |
when: not db_file.stat.exists |
|
86 |
||
87 |
- name: create admin |
|
88 |
become: yes |
|
89 |
become_user: "{{writefreely_user}}" |
|
90 |
command: "writefreely --create-admin admin:admin" |
|
91 |
args: |
|
92 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
93 |
when: not db_file.stat.exists |
|
94 |
||
95 |
- name: migrate db |
|
96 |
become: yes |
|
97 |
become_user: "{{writefreely_user}}" |
|
98 |
command: "writefreely db migrate" |
|
99 |
args: |
|
100 |
chdir: "{{writefreely_dir}}/{{writefreely_instance}}/" |
|
101 |
when: db_file.stat.exists |
|
102 |
||
103 |
- name: install systemd service |
|
104 |
become: yes |
|
105 |
template: |
|
106 |
src: "[email protected]" |
|
107 |
dest: "/lib/systemd/system/[email protected]" |
|
108 |
||
109 |
- name: ensure service is started |
|
110 |
become: yes |
|
111 |
systemd: name="writefreely@{{writefreely_instance}}.service" enabled="yes" state="started" |