-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdeploy-playbook.yml
More file actions
105 lines (92 loc) · 2.53 KB
/
deploy-playbook.yml
File metadata and controls
105 lines (92 loc) · 2.53 KB
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
---
- name: Deploy Discord Bot to the server
hosts: all
vars:
repository_url: https://github.com/EuroPython/discord.git
tasks:
- name: Enable persistent logging for journald
ini_file:
path: /etc/systemd/journald.conf
section: Journal
option: Storage
value: persistent
no_extra_spaces: true
backup: true
- name: reload systemd-journald
systemd:
name: systemd-journald
state: restarted
- name: Install Docker dependencies
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
- name: Install Docker
block:
- name: Add docker APT repository (Ubuntu 24.04)
ansible.builtin.deb822_repository:
name: docker
types: [ deb ]
uris: "https://download.docker.com/linux/ubuntu"
signed_by: "https://download.docker.com/linux/ubuntu/gpg"
suites: ["noble"]
components: [stable]
state: present
enabled: yes
- name: Install Docker
apt:
name: docker-ce
state: present
update_cache: yes
- name: Clone repository
git:
repo: "{{ repository_url }}"
dest: /root/discord
depth: 1
force: yes
accept_hostkey: yes
single_branch: yes
version: main
- name: Ensure 'bot' group exists
group:
name: bot
gid: 1000
- name: Create 'bot' user
user:
name: bot
uid: 1000
group: 1000
home: /home/bot
- name: Create registration_log.txt in bot's home directory
file:
path: /home/bot/registered_log.txt
state: touch
owner: bot
group: bot
- name: Create livestreams.toml in bot's home directory
file:
path: /home/bot/livestreams.toml
state: touch
owner: bot
group: bot
- name: Create pretix_cache.json in bot's home directory
file:
path: /home/bot/pretix_cache.json
state: touch
owner: bot
group: bot
- name: Create schedule_cache.json in bot's home directory
file:
path: /home/bot/schedule_cache.json
state: touch
owner: bot
group: bot
- name: Start Discord Bot
shell: "cd /root/discord && docker compose down && docker compose up --detach --build"