Skip to content

Commit

Permalink
Use default python3 modules and run the default roles
Browse files Browse the repository at this point in the history
Also fixed indendation and styling
  • Loading branch information
vmcj committed Sep 12, 2024
1 parent 3a498c6 commit 8ef0121
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 46 deletions.
19 changes: 9 additions & 10 deletions provision-contest/ansible/glitchtip.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---

- hosts: glitchtip
vars:
host_type: glitchtip
become: true
handlers:
- include_tasks: handlers.yml
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: 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: docker
tags: docker
- role: glitchtip
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
54 changes: 28 additions & 26 deletions provision-contest/ansible/roles/docker/tasks/load-container.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
---
- block:
- name: Check for existing container
community.docker.docker_image_info:
name: "{{ img_name }}"
register: result
- name: Load the container from archive if needed
block:
- name: Check for existing container
community.docker.docker_image_info:
name: "{{ img_name }}"
register: result

- block:
- name: Create temp container directory
file:
path: /tmp/dj_ansible
state: directory
owner: root
group: root
mode: 0700
- name: Transfer and load the container
block:
- name: Create temp container directory
file:
path: /tmp/dj_ansible
state: directory
owner: root
group: root
mode: 0700

- name: Transfer container archive
copy:
src: "{{ item.src }}"
dest: "{{ img_path }}"
owner: root
group: root
mode: 0700
- name: Transfer container archive
copy:
src: "{{ item.src }}"
dest: "{{ img_path }}"
owner: root
group: root
mode: 0700

- name: Import container from archive
community.docker.docker_image:
name: "{{ img_name }}"
load_path: "{{ img_path }}"
source: load
when: not result.images
- name: Import container from archive
community.docker.docker_image:
name: "{{ img_name }}"
load_path: "{{ img_path }}"
source: load
when: not result.images
vars:
img_name: "{{ item.path | splitext | first }}"
img_path: "/tmp/dj_ansible/{{ item.path | basename }}"
5 changes: 1 addition & 4 deletions provision-contest/ansible/roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
- docker-ce-cli
- docker-compose-plugin
- python3-pip

- name: Install Docker module for Python
pip:
name: docker
- python3-docker

- name: Remove executable bit from "/usr/local/bin/runc"
file:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
glitchtip_port: 8000
GLITCHTIP_PORT: 8000
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
community.docker.docker_compose_v2:
project_src: /opt/glitchtip
files:
- docker-compose.yaml
- docker-compose.yaml
state: restarted
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
x-environment:
&default-environment
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
SECRET_KEY: {{GLITCHTIP_SECRET}}
PORT: {{glitchtip_port}}
SECRET_KEY: {{ GLITCHTIP_SECRET }}
PORT: {{ GLITCHTIP_PORT}}
EMAIL_URL: consolemail://
GLITCHTIP_DOMAIN: http://glitchtip:{{glitchtip_port}}
GLITCHTIP_DOMAIN: http://glitchtip:{{ GLITCHTIP_PORT }}
DEFAULT_FROM_EMAIL: email@glitchtip
CELERY_WORKER_AUTOSCALE: "1,1"
CELERY_WORKER_MAX_TASKS_PER_CHILD: "1000"
Expand All @@ -31,7 +31,7 @@ services:
image: glitchtip/glitchtip:v4.1.3
depends_on: *default-depends_on
ports:
- {{glitchtip_port}}:{{glitchtip_port}}
- {{ GLITCHTIP_PORT }}:{{ GLITCHTIP_PORT }}
environment: *default-environment
restart: unless-stopped
volumes:
Expand Down

0 comments on commit 8ef0121

Please sign in to comment.