91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
---
|
|
- name: Install xworkmate-bridge prerequisites
|
|
ansible.builtin.package:
|
|
name:
|
|
- caddy
|
|
state: present
|
|
|
|
- name: Ensure xworkmate-bridge base directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ xworkmate_bridge_base_dir }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Deploy xworkmate-bridge runtime configuration
|
|
ansible.builtin.template:
|
|
src: config.yaml.j2
|
|
dest: "{{ xworkmate_bridge_base_dir }}/config.yaml"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Reload bridge
|
|
|
|
- name: Assert xworkmate-bridge deploy uses prebuilt registry image
|
|
ansible.builtin.assert:
|
|
that:
|
|
- service_compose_image | trim | length > 0
|
|
- "'/' in (service_compose_image | trim)"
|
|
- "':' in (service_compose_image | trim)"
|
|
fail_msg: >-
|
|
XWORKMATE_BRIDGE deploy requires a prebuilt image reference via
|
|
SERVICE_COMPOSE_IMAGE.
|
|
|
|
- name: Log into container registry for xworkmate-bridge
|
|
ansible.builtin.shell: |
|
|
set -euo pipefail
|
|
printf '%s' '{{ service_compose_registry_password }}' | docker login {{ service_compose_registry_server }} -u '{{ service_compose_registry_username }}' --password-stdin
|
|
args:
|
|
executable: /bin/bash
|
|
no_log: true
|
|
when:
|
|
- service_compose_registry_username | length > 0
|
|
- service_compose_registry_password | length > 0
|
|
|
|
- name: Render xworkmate-bridge compose file
|
|
ansible.builtin.template:
|
|
src: docker-compose.yml.j2
|
|
dest: "{{ xworkmate_bridge_compose_file }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Validate xworkmate-bridge compose file
|
|
ansible.builtin.command: >-
|
|
docker compose
|
|
--project-name {{ xworkmate_bridge_project_name }}
|
|
-f {{ xworkmate_bridge_compose_file }}
|
|
config
|
|
args:
|
|
chdir: "{{ xworkmate_bridge_base_dir }}"
|
|
changed_when: false
|
|
|
|
- name: Pull xworkmate-bridge image
|
|
ansible.builtin.command: >-
|
|
docker compose
|
|
--project-name {{ xworkmate_bridge_project_name }}
|
|
-f {{ xworkmate_bridge_compose_file }}
|
|
pull bridge
|
|
args:
|
|
chdir: "{{ xworkmate_bridge_base_dir }}"
|
|
when:
|
|
- not ansible_check_mode
|
|
|
|
- name: Start xworkmate-bridge compose target
|
|
ansible.builtin.command: >-
|
|
docker compose
|
|
--project-name {{ xworkmate_bridge_project_name }}
|
|
-f {{ xworkmate_bridge_compose_file }}
|
|
up -d --force-recreate --remove-orphans bridge
|
|
args:
|
|
chdir: "{{ xworkmate_bridge_base_dir }}"
|
|
when:
|
|
- not ansible_check_mode
|
|
|
|
- name: Include ACP ingress validation tasks
|
|
ansible.builtin.import_tasks: validate.yml
|
|
tags: [xworkmate_bridge, xworkmate_bridge_validate]
|
|
when:
|
|
- not ansible_check_mode
|