-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapps_bark.yml
74 lines (64 loc) · 2.02 KB
/
apps_bark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- name: Deploy bark on Alpine LXC
gather_facts: no
hosts: bark
connection: local
ignore_errors: no
vars:
bark_version: "v2.2.0"
tasks:
- name: Read current version
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "if [ -f /opt/bark/version ]; then cat /opt/bark/version; fi"
register: result
- name: Check current version
meta: end_play
when: result.output == bark_version
- name: Use USTC mirrors
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories"
- name: Install wget libcap
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "apk update && apk add wget libcap"
- name: Create run directory
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "mkdir -p /opt/bark"
- name: Backup old
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "if [ -f /opt/bark/bark ]; then mv -f /opt/bark/bark /opt/bark/bark.old; fi"
- name: Download bark
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "wget https://github.com/Finb/bark-server/releases/download/{{ bark_version }}/bark-server_linux_amd64 -O /opt/bark/bark"
- name: Create init.d
pct:
cmd: "push"
host: "{{ inventory_hostname }}"
src: "./apps/bark/init.d.sh"
dest: "/etc/init.d/bark"
extra_args: "--perms 0755"
- name: Create Update Daemon
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "rc-update add bark"
- name: Restart bark
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "/etc/init.d/bark restart"
- name: Write current version
pct:
cmd: "exec"
host: "{{ inventory_hostname }}"
extra_args: "echo {{ bark_version }} > /opt/bark/version"