Files
obs-deploy/obs/repo.yml
2025-11-13 15:56:45 +08:00

43 lines
1.5 KiB
YAML

- name: OBS Repo Service Bundle
hosts: obs_repo
tasks:
- name: Create Deployment Root Directory
ansible.builtin.file:
path: "{{ OBS_DEPLOY_LOCATION }}/binary"
state: directory
- name: Copy Files
block:
- ansible.builtin.copy:
src: dockerfiles/Dockerfile.backend
dest: "{{ OBS_DEPLOY_LOCATION }}/binary/Dockerfile.backend"
notify: Restart Container
- ansible.builtin.copy:
src: dockerfiles/common-files/
dest: "{{ OBS_DEPLOY_LOCATION }}/binary/common-files"
mode: preserve
notify: Restart Container
- ansible.builtin.copy:
src: dockerfiles/backend-files/
dest: "{{ OBS_DEPLOY_LOCATION }}/binary/backend-files"
mode: preserve
notify: Restart Container
- name: Populate Docker Compose
ansible.builtin.template:
src: docker-compose/binary/docker-compose.yml
dest: "{{ OBS_DEPLOY_LOCATION }}/binary/docker-compose.yml"
notify: Restart Container
- name: Force Restart Containers
when: restart_container is defined
changed_when: true
ansible.builtin.debug:
msg: "Force Restart Container"
notify: Restart Container
handlers:
- name: Restart Container
ansible.builtin.shell:
chdir: "{{ OBS_DEPLOY_LOCATION }}/binary"
cmd: |
docker compose down || true
docker compose build --no-cache
docker compose up -d