-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
65 lines (54 loc) · 2.08 KB
/
deploy.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
---
- name : Install Teamspeak3 Server
hosts: ts
vars:
home: /home/{{service_user}}
become_method: sudo
tasks:
- name: download teamspeak3 files
get_url:
url: https://files.teamspeak-services.com/releases/server/3.7.1/teamspeak3-server_linux_amd64-3.7.1.tar.bz2
dest: '{{home}}/ts.tar.bz2'
owner: '{{service_user}}'
- name: mkdir ts
file:
path: '{{home}}/ts'
state: directory
owner: '{{service_user}}'
- name: unpack archive
unarchive:
src: '{{home}}/ts.tar.bz2'
dest: '{{home}}/ts'
copy: no
extra_opts: [--strip-components=1]
owner: '{{service_user}}'
- name: delete archive
file:
path: '{{home}}/ts.tar.bz2'
state: absent
- name: accept ts3_license
file:
path: '{{home}}/ts/.ts3server_license_accepted'
state: touch
owner: '{{service_user}}'
- name: copy service template
template:
src: teamspeak3.service.j2
dest: /etc/systemd/system/teamspeak3.service
become: True
- name: enable service
service:
name: teamspeak3
state: started
enabled: True
become: True
- name: wait for token to be set
pause:
seconds: 5
- name: set TS_TOKEN
shell: grep token= {{home}}/ts/logs/*.log | cut -f2 -d"="
register: out
- set_fact:
ts_token: "{{out.stdout}}"
- name: display TS_TOKEN
debug: msg="Token of the new server= {{ ts_token }}"