Implement very naive solution

This commit is contained in:
Marty Oehme 2021-07-29 22:50:41 +02:00
parent 351e1202b2
commit 1b3c14b4ce
Signed by: Marty
GPG key ID: B7538B8F50A1C800
5 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,28 @@
---
# install whoami container
- name: Deploy whoami to swarm
community.general.docker_stack:
name: "{{ item.name }}"
state: present
prune: yes
compose:
- "{{ item.compose }}"
with_items: "{{ whoami_stack }}"
when: whoami_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: 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