File tree Expand file tree Collapse file tree 4 files changed +37
-17
lines changed Expand file tree Collapse file tree 4 files changed +37
-17
lines changed Original file line number Diff line number Diff line change @@ -18,26 +18,36 @@ ADMIN_PASSWORD: some-admin-password
18
18
# created on the domserver and judgehosts.
19
19
#DJ_SHELL_USER_PW: some-hashed-password
20
20
21
- # Users to create when setting up the CDS
22
- CDS_USERS :
21
+ # Accounts to create when setting up the CDS
22
+ CDS_ACCOUNTS :
23
23
- username: admin
24
24
password: adm1n
25
+ type: admin
25
26
- username: presAdmin
26
27
password: padm1n
28
+ type: admin
27
29
- username: blue
28
30
password: blu3
31
+ type: staff
29
32
- username: balloon
30
33
password: balloonPr1nter
34
+ type: balloon
31
35
- username: public
32
36
password: publ1c
37
+ type: public
33
38
- username: presentation
34
39
password: presentat1on
40
+ type: public
35
41
- username: myicpc
36
42
password: my1cpc
43
+ type: spectator
37
44
- username: live
38
45
password: l1ve
46
+ type: analyst
39
47
- username: team1
40
48
password: t3am
49
+ type: team
50
+ team_id: 1
41
51
42
52
# Contest(s) to configure in the CDS
43
53
CDS_CONTESTS:
Original file line number Diff line number Diff line change 1
1
---
2
2
# These tasks configure the CDS
3
3
4
- - name : Get the latest CDS release
4
+ - name : Get the CDS release
5
5
uri :
6
- url : https://api.github.com/repos/icpctools/icpctools/releases/latest
6
+ url : https://api.github.com/repos/icpctools/icpctools/releases?per_page=1
7
7
method : GET
8
8
return_content : yes
9
9
status_code : 200
10
10
body_format : json
11
- register : latest_cds_release
11
+ register : latest_cds_release_array
12
12
13
13
- name : Set CDS latest version
14
14
set_fact :
15
- cds_version : " {{ latest_cds_release.json.name | replace('v', '') }}"
15
+ cds_version : " {{ latest_cds_release_array.json[0].name | replace('v', '') }}"
16
+
17
+ - name : Set CDS minor version
18
+ set_fact :
19
+ cds_version_minor : " {{ cds_version | regex_replace('\\ .\\ d+$', '') }}"
16
20
17
21
- name : Check if CDS is installed
18
22
stat :
46
50
47
51
- name : Copy new CDS war
48
52
copy :
49
- src : /root/CDS-2.3 /CDS.war
53
+ src : /root/CDS-{{ cds_version_minor }} /CDS.war
50
54
dest : /home/domjudge/cds/wlp/usr/servers/cds/apps/CDS.war
51
55
remote_src : yes
52
56
owner : domjudge
53
57
group : domjudge
54
58
when : cds_war.stat.exists
55
59
notify : restart cds
56
60
57
- - name : Populate CDS users.xml
61
+ - name : Populate CDS accounts.json
58
62
template :
59
- src : users.xml .j2
60
- dest : /home/domjudge/cds/wlp/usr/servers/cds/users.xml
63
+ src : accounts.json .j2
64
+ dest : /home/domjudge/cds/wlp/usr/servers/cds/config/accounts.json
61
65
owner : domjudge
62
66
group : domjudge
63
67
mode : 0600
Original file line number Diff line number Diff line change
1
+ [
2
+ {% for account in CDS_ACCOUNTS %}
3
+ {
4
+ "id": "{{ account.username }}",
5
+ "username": "{{ account.username }}",
6
+ "password": "{{ account.password }}",
7
+ "type": "{{ account.type }}"{% if account .team_id is defined %} ,
8
+ "team_id": "{{ account.team_id }}"{% endif %}
9
+
10
+ }{% if not loop .last %} ,{% endif %}
11
+
12
+ {% endfor %}
13
+ ]
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments