38 lines
1 KiB
YAML
38 lines
1 KiB
YAML
---
|
|
## install container
|
|
- name: Check upstream status
|
|
community.docker.docker_container_exec:
|
|
container: "{{ caddy_container_id }}"
|
|
command: >
|
|
curl localhost:2019/id/{{ stack_name }}_upstream/
|
|
register: result
|
|
changed_when: (result.stdout | from_json) != (lookup('template', 'upstream.json.j2') | from_yaml)
|
|
become: true
|
|
notify: "update nextcloud upstream"
|
|
|
|
- name: Ensure target directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ nextcloud_upstream_file_dir }}"
|
|
state: directory
|
|
mode: "0755"
|
|
become: true
|
|
notify: "update nextcloud upstream"
|
|
|
|
- name: Move webserver Caddyfile to target dir
|
|
ansible.builtin.copy:
|
|
src: "Caddyfile"
|
|
dest: "{{ nextcloud_upstream_file_dir }}/Caddyfile"
|
|
become: true
|
|
notify: "update nextcloud upstream"
|
|
|
|
- name: Deploy to swarm
|
|
community.general.docker_stack:
|
|
name: "{{ stack_name }}"
|
|
state: present
|
|
prune: yes
|
|
compose:
|
|
- "{{ stack_compose }}"
|
|
become: true
|
|
tags:
|
|
- docker-swarm
|
|
notify: "update nextcloud upstream"
|