-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbtsync_home.yml
117 lines (102 loc) · 2.39 KB
/
btsync_home.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# TODO: jailkit
---
- hosts: all
vars_files:
- networks.yml
- btsync_vars.yml
tasks:
- name: Download btsync
get_url: url={{ url }}/{{ tgz }}
dest=/root/{{ tgz }}
tags:
- packages
- name: Create btsync user
user: name=btsync
password=*
home={{btsync.home}}
shell=/sbin/nologin
tags:
- users
# DO NOT REMOVE append=yes!
- name: Enable sysop in btsync
user: name=sysop
groups=btsync
append=yes
tags:
- users
- name: Create /opt/btsync/bin
file: path=/opt/btsync/bin
owner=root
group=root
state=directory
tags:
- directories
- name: Create public directory
file: path={{btsync.rwdir}}
owner=root
group=btsync
mode=0775
state=directory
tags:
- directories
- name: Create read-only directory
file: path={{btsync.rodir}}
owner=root
group=btsync
mode=0775
state=directory
tags:
- directories
- name: Create /var/run/btsync
file: path=/var/run/btsync
owner=root
group=btsync
mode=0770
state=directory
tags:
- directories
- name: Unzip btsync
shell: tar xvz -C /opt/btsync/bin -f /root/{{ tgz }}
tags:
- packages
- name: Install /etc/init.d/btsync
template: src=etc/init.d/btsync.j2
dest=/etc/init.d/btsync
owner=root
group=root
mode=0750
tags:
- config
notify:
- Restart btsync
- name: Install /etc/btsync.conf
template: src=etc/btsync_home.conf.j2
dest=/etc/btsync.conf
owner=root
group=btsync
mode=0640
tags:
- config
notify:
- Restart btsync
- name: Install /etc/shorewall/rules.d/btsync
template: src=etc/shorewall/rules.d/btsync_home.j2
dest=/etc/shorewall/rules.d/btsync
owner=root
group=root
mode=0640
tags:
- firewall
notify:
- Restart shorewall
- name: Start btsync
service: name=btsync
state=started
enabled=yes
handlers:
- name: Restart btsync
service: name=btsync
state=restarted
- name: Restart shorewall
service: name=shorewall
state=restarted