54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
- name: OBS Docker-based Worker
|
|
hosts: obs_worker
|
|
tasks:
|
|
- name: Ensure System Dpendencies
|
|
when: SKIP_OS_SETUP is not defined or not SKIP_OS_SETUP
|
|
become: true
|
|
ansible.builtin.package:
|
|
name:
|
|
- qemu-user-static
|
|
- name: Create Deployment Root Directory
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/worker"
|
|
state: directory
|
|
- name: Copy Files
|
|
become: true
|
|
block:
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/Dockerfile.worker
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/worker/Dockerfile.worker"
|
|
notify: Restart Container
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/common-files/
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/worker/common-files"
|
|
mode: preserve
|
|
notify: Restart Container
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/worker-files/
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/worker/worker-files"
|
|
mode: preserve
|
|
notify: Restart Container
|
|
- name: Populate Docker Compose
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: docker-compose/worker/docker-compose.yml
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/worker/docker-compose.yml"
|
|
notify: Restart Container
|
|
- name: Force Restart Containers
|
|
become: true
|
|
when: restart_container is defined
|
|
changed_when: true
|
|
ansible.builtin.debug:
|
|
msg: "Force Restart Container"
|
|
notify: Restart Container
|
|
handlers:
|
|
- name: Restart Container
|
|
become: true
|
|
ansible.builtin.shell:
|
|
chdir: "{{ OBS_DEPLOY_LOCATION }}/worker"
|
|
cmd: |
|
|
docker compose down || true
|
|
docker compose build --no-cache
|
|
docker compose up -d
|