53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
- name: OBS Web Caching Service
|
|
hosts: obs_cache
|
|
tasks:
|
|
- name: Create Deployment Root Directory
|
|
ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/cache"
|
|
state: directory
|
|
- name: Copy Files
|
|
block:
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/Dockerfile.squid
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/cache/Dockerfile.squid"
|
|
notify: Restart Container
|
|
- ansible.builtin.copy:
|
|
src: dockerfiles/squid-files/
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/cache/squid-files"
|
|
mode: preserve
|
|
notify: Restart Container
|
|
- name: Populate Docker Compose
|
|
ansible.builtin.template:
|
|
src: docker-compose/cache/docker-compose.yml
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/cache/docker-compose.yml"
|
|
notify: Restart Container
|
|
- name: "Preconfigure Volume: SSL CA"
|
|
block:
|
|
- ansible.builtin.file:
|
|
path: "{{ OBS_DEPLOY_LOCATION }}/cache/volume/cert"
|
|
state: directory
|
|
- ansible.builtin.copy:
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/cache/volume/cert/squid-ca.pem"
|
|
src: "{{ CACHE_SSL_CA_PEM }}"
|
|
notify: Restart Container
|
|
- name: "Preconfigure Volume: squid conf.d/"
|
|
block:
|
|
- ansible.builtin.copy:
|
|
dest: "{{ OBS_DEPLOY_LOCATION }}/cache/volume/conf.d/"
|
|
src: "{{ SQUID_CONF_D }}/"
|
|
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 }}/cache"
|
|
cmd: |
|
|
docker compose build --no-cache
|
|
docker compose down || true
|
|
docker compose up -d
|