-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathadmin.yml
171 lines (155 loc) · 4.6 KB
/
admin.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
# This playbook an admin machine with a dev DOMjudge instance
- name: Setup admin machines
hosts: admin
vars:
host_type: admin
become: true
roles:
- role: base_packages
tags: base_packages
- role: icpc_fixes
tags: icpc_fixes
when: ICPC_IMAGE
- role: system_fixes
tags: system_fixes
- role: hosts
tags: hosts
- role: ssl
tags: ssl
vars:
INSTALL_SSL_PRIVATE_KEYS: true
- role: domjudge_user
tags: domjudge_user
- role: ssh
tags: ssh
- role: mysql_server
tags: mysql_server
- role: domjudge_checkout
tags: domjudge_checkout
- role: domjudge_build
tags: domjudge_build
vars:
DOMSERVER: https://localhost
- role: domserver
tags: domserver
- role: judgedaemon
tags: judgedaemon
- role: clusterssh
tags: clusterssh
- role: phpstorm
tags: phpstorm
- role: dj_notify
tags: dj_notify
- role: prometheus_target_all
tags: prometheus_target_all
when: GRAFANA_MONITORING
handlers:
- include: handlers.yml
tasks:
- name: Install common required/useful packages
tags: packages
apt:
state: present
pkg:
- ansible
- git-gui
- gitk
- makepasswd
- mmv
- python3-pdfkit
- xkcdpass
- name: Enable developer mode
lineinfile:
regexp: 'APP_ENV='
line: 'APP_ENV=dev'
dest: "{{ DJ_DIR }}/webapp/.env.local"
create: true
- name: Update repo URL based on network
set_fact:
dj_git_repo_scripts: "{{ DJ_GIT_REPO_SCRIPTS_RESTRICTED if WF_RESTRICTED_NETWORK else DJ_GIT_REPO_SCRIPTS }}"
- name: Copy custom CSS file for admin machines
copy:
src: admin-machine.css
dest: "{{ DJ_DIR }}/webapp/public/css/custom/admin-machine.css"
owner: domjudge
group: domjudge
mode: 0644
notify: Clear application cache
- name: Check if netrc file exists
stat:
path: /home/domjudge/.netrc
get_attributes: false
get_checksum: false
get_mime: false
register: netrc_file
check_mode: no
- name: Install netrc file
template:
src: files/netrc.j2
dest: /home/domjudge/.netrc
owner: domjudge
group: domjudge
mode: 0600
when: not netrc_file.stat.exists
- name: Install .my.cnf file
template:
src: files/admin.my.cnf.j2
dest: /home/domjudge/.my.cnf
owner: domjudge
group: domjudge
mode: 0600
- name: Create local python directory
become: true
become_user: domjudge
file:
path: "/home/domjudge/.local/lib/python3.8"
state: directory
mode: '0755'
owner: domjudge
group: domjudge
- name: Install local python packages
synchronize:
src: files/admin-python/
dest: "/home/domjudge/.local/lib/python3.8"
owner: false
use_ssh_args: true
- name: Fix ownership of local python packages
file:
path: "/home/domjudge/.local/lib/python3.8"
recurse: true
owner: domjudge
group: domjudge
- name: Grant www-data permissions to user homedir (needed for web browser)
acl:
path: "/home/domjudge"
entity: www-data
etype: user
permissions: rwx
state: present
- name: Download offline repos
when: WF_RESTRICTED_NETWORK
become: true
become_user: domjudge
block:
- name: Add ccsadmin remote
git_config:
name: "remote.{{ item.remote }}.url"
value: "{{ item.url }}"
scope: local
repo: /home/domjudge/domjudge-checkout
loop:
- remote: origin
url: ansible@10.3.3.224:domjudge
- remote: github
url: git@github.com:DOMjudge/domjudge.git
- remote: sysops
url: domjudge@packages:domjudge.git
- remote: initial
url: ansible@domjudge-ccsadmin1:domjudge.git
- name: Create working copy of the domjudge-scripts repo
# We use a different directory here to have one single 'upstream' and not have issues with it
git: repo={{ dj_git_repo_scripts }} dest=/home/domjudge/domjudge-scripts-checkout version=main accept_hostkey=yes update=no
- name: Create working copy of the contest repo
ignore_errors: true
git: repo=git@packages:{{ CONTEST_REPO }} dest=/home/domjudge/{{ CONTEST_REPO }} version=master accept_hostkey=yes update=no