61 lines
2.4 KiB
YAML
61 lines
2.4 KiB
YAML
- name: OBS Source Service Bundle
|
|
hosts: obs_source
|
|
tasks:
|
|
- name: Create Deployment Root Directory
|
|
ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/source"
|
|
state: directory
|
|
- name: Copy Files
|
|
block:
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/Dockerfile.backend
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/Dockerfile.backend"
|
|
notify: Restart Container
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/common-files/
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/common-files"
|
|
mode: preserve
|
|
notify: Restart Container
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/backend-files/
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/backend-files"
|
|
mode: preserve
|
|
notify: Restart Container
|
|
- name: Populate Docker Compose
|
|
ansible.builtin.template:
|
|
src: docker-compose/source/docker-compose.yml
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/docker-compose.yml"
|
|
notify: Restart Container
|
|
- name: Populate Volume - scm-bridge configuration dir
|
|
ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/source/volume/scmbridge-conf"
|
|
state: directory
|
|
- name: Populate Volume - scm-bridge critical instance
|
|
ansible.builtin.copy:
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/volume/scmbridge-conf/critical-instances"
|
|
content: |
|
|
build.opensuse.org
|
|
- name: Populate Volume - CA cert
|
|
ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/source/volume/cert"
|
|
state: directory
|
|
- name: Populate Volume - OBS Cache CA
|
|
ansible.builtin.copy:
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/source/volume/cert/obs-cache.pem"
|
|
content: "{{ lookup('ansible.builtin.file', (groups['obs_cache'][0] | extract(hostvars))['CACHE_SSL_CA_PEM']) | regex_search('-----BEGIN CERTIFICATE-----[\\s\\S]*-----END CERTIFICATE-----', multiline=True) }}"
|
|
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 }}/source"
|
|
cmd: |
|
|
docker compose build --no-cache
|
|
docker compose down || true
|
|
docker compose up -d
|