Add more stable reverse proxy updating
This commit is contained in:
parent
95832941c0
commit
03a0b0ce00
5 changed files with 71 additions and 30 deletions
|
|
@ -1,35 +1,32 @@
|
|||
---
|
||||
# install whoami container
|
||||
- name: Ensure upstream directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ whoami_upstream_file_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
become: true
|
||||
tags:
|
||||
- fs
|
||||
|
||||
- name: Update upstream template
|
||||
ansible.builtin.template:
|
||||
src: whoami_upstream.json.j2
|
||||
dest: "{{ whoami_upstream_file_dir }}/upstream.json"
|
||||
become: true
|
||||
tags:
|
||||
- fs
|
||||
notify: "handle upstream"
|
||||
|
||||
- name: Deploy whoami to swarm
|
||||
community.general.docker_stack:
|
||||
name: "{{ item.name }}"
|
||||
name: "{{ stack.name }}"
|
||||
state: present
|
||||
prune: yes
|
||||
compose:
|
||||
- "{{ item.compose }}"
|
||||
with_items: "{{ whoami_stack }}"
|
||||
when: whoami_stack is defined
|
||||
- "{{ stack.compose }}"
|
||||
when: stack is defined
|
||||
become: yes
|
||||
tags:
|
||||
- docker-swarm
|
||||
|
||||
- name: Get caddy container id
|
||||
ansible.builtin.command:
|
||||
cmd: docker ps -q -f name=caddy_app
|
||||
register: caddy_container_id
|
||||
become: yes
|
||||
|
||||
- name: Ensure caddy curl available
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id.stdout }}"
|
||||
command: >
|
||||
apk add curl
|
||||
become: yes
|
||||
|
||||
- name: Add caddy reverse proxy
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id.stdout }}"
|
||||
command: >
|
||||
curl localhost:2019/config/apps/http/servers/srv0/routes/0 -X POST -H "Content-Type: application/json" -d {{ whoami_upstream }}
|
||||
become: yes
|
||||
notify: "handle upstream"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue