Files
obs-deploy/obs/database.yml
2025-11-21 17:32:21 +08:00

38 lines
1.3 KiB
YAML

- name: Database for OBS API Service
hosts: obs_db
tasks:
- name: Create Deployment Root Directory
ansible.builtin.file:
path: "{{ OBS_DEPLOY_LOCATION }}/database"
state: directory
- name: Copy Files
block:
- ansible.builtin.copy:
src: dockerfiles/Dockerfile.database
dest: "{{ OBS_DEPLOY_LOCATION }}/database/Dockerfile.database"
notify: Restart Container
- ansible.builtin.copy:
src: dockerfiles/database-files/
dest: "{{ OBS_DEPLOY_LOCATION }}/database/database-files"
mode: preserve
notify: Restart Container
- name: Populate Docker Compose
ansible.builtin.template:
src: docker-compose/database/docker-compose.yml
dest: "{{ OBS_DEPLOY_LOCATION }}/database/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 }}/database"
cmd: |
docker compose build --no-cache
docker compose down || true
docker compose up -d