Files
domjudge/roles/configure_judgehost/tasks/main.yml

69 lines
2.0 KiB
YAML

---
- name: Add boot parameters (Archlinux)
ansible.builtin.lineinfile:
path: /boot/loader/entries/arch.conf
line: >-
options cgroup_enable=memory
notify: Reboot
when: ansible_facts['distribution'] == "Archlinux"
- name: Add boot parameters (Debian)
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT='
line: >-
GRUB_CMDLINE_LINUX_DEFAULT="quiet
cgroup_enable=memory swapaccount=1 isolcpus=0
systemd.unified_cgroup_hierarchy=0"
notify:
- Update grub
- Reboot
when: ansible_facts['distribution'] == "Debian"
- name: Flush handlers
ansible.builtin.meta: flush_handlers
- name: Fetch judgehost password
community.docker.docker_compose_v2_exec:
project_src: "{{ domjudge_base_dir }}"
service: domserver
command: >-
sed -nr 's/^.*\W+judgehost\W+(.+)$/\1/p'
/opt/domjudge/domserver/etc/restapi.secret
delegate_to: "{{ groups['domserver'] | first }}"
run_once: true
register: fetch_reg
- name: Set judgehost facts
ansible.builtin.set_fact:
domserver_url: "{{ domserver_url }}"
judgehost_password: "{{ fetch_reg['stdout'] }}"
run_once: true
- name: Show judgehost password
ansible.builtin.debug:
var: judgehost_password
- name: Install judgehost directory
ansible.builtin.file:
path: "{{ domjudge_base_dir }}"
state: directory
mode: '0750'
owner: root
group: docker
- name: Install judgehost docker compose
notify:
- Restart judgehost docker compose
block:
- name: Install docker-compose.yml
ansible.builtin.template:
src: docker-compose.yml.jinja
dest: "{{ domjudge_base_dir }}/docker-compose.yml"
mode: '0644'
owner: root
group: root
- name: Enable and start docker
ansible.builtin.systemd_service:
name: docker.service
state: started
enabled: true
- name: Run docker compose up
community.docker.docker_compose_v2:
project_src: "{{ domjudge_base_dir }}"