Skip to content

Ansible scripts ci #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ansible-deployments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test contest deployment (ansible scripts)

on: [push,pull_request]

jobs:
test_domjudge_role:
strategy:
matrix:
os: [22.04, 20.04]
role: [domserver]
runs-on: ubuntu-20.04
container: ubuntu:${{ matrix.os }}

steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: remove package
run: apt update; apt purge mysql-server -y
- name: Install ansible lint tools + SQL server
run: apt install ansible sudo make -y
- run: mount
#mariadb-server -y
#- name: Check that mariadb works
# if: ${{ matrix.os == '22.04' }}
# run: service mariadb restart; service mariadb status
- name: Setup the hosts file
working-directory: ./icpc-wf/ansible
run: sed -i 's/\[${{ matrix.role }}\]/[removed]/g' hosts; printf '\n[${{ matrix.role }}]\ngithub-action\tansible_host=localhost ansible_connection=local' >> hosts
- name: Generate insecure credentials
working-directory: ./icpc-wf/ansible
run: mv group_vars/all/secret.yml.example group_vars/all/secret.yml
- name: Run the default deployment method
working-directory: ./icpc-wf/ansible
run: make ${{ matrix.role }}
3 changes: 3 additions & 0 deletions icpc-wf/ansible/group_vars/all/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ DOMSERVER_URL: "{{DOMSERVER}}"
DOMSERVER_SSL_CERT: /etc/ssl/certs/domserver.crt
DOMSERVER_SSL_KEY: /etc/ssl/private/domserver.key

# Set this to true when you are using an image with a graphical desktop
GRAPHICAL: false

# Set this to true when you are using the ICPC World Finals Contest Image
ICPC_IMAGE: false

Expand Down
3 changes: 3 additions & 0 deletions icpc-wf/ansible/judgehost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@
tags: prometheus_target_all
when: GRAFANA_MONITORING
pre_tasks:
- name: Get current services
service_facts:
- name: Disable all cores
service:
name="domjudge-judgedaemon@{{item}}"
state=stopped
with_sequence: start=0 end={{ ansible_processor_vcpus }} format=domjudge-judgedaemon@%1x
when: '"[email protected]" in services'
tasks:
- name: add autostart shortcuts
template:
Expand Down
5 changes: 5 additions & 0 deletions icpc-wf/ansible/mysqlhandler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Define here handlers associated to this role.

- name: restart mysql
command: ls
2 changes: 2 additions & 0 deletions icpc-wf/ansible/roles/domjudge_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
line: 'AutomaticLoginEnable=true'
create: yes
notify: restart gdm
when: GRAPHICAL

- name: Automatically login domjudge user
lineinfile:
path: /etc/gdm3/custom.conf
regexp: 'AutomaticLogin='
line: 'AutomaticLogin=domjudge'
notify: restart gdm
when: GRAPHICAL

- name: make sure autostart directory exists
file: dest=/home/domjudge/.config/autostart state=directory owner=domjudge group=domjudge
1 change: 1 addition & 0 deletions icpc-wf/ansible/roles/system_fixes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
- name: Force enable alt-tab for switching windows
copy: src=dconf/ dest=/etc/dconf/
notify: update dconf
when: GRAPHICAL