Move upstream logic to handler function

This commit is contained in:
Marty Oehme 2021-08-18 09:42:39 +02:00
parent 09f15d5b8e
commit 6036a91902
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 36 additions and 18 deletions

View file

@ -1,21 +1,13 @@
---
# 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: upstream.json.j2
dest: "{{ whoami_upstream_file_dir }}/upstream.json"
become: true
tags:
- fs
## install whoami 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: yes
notify: "update upstream"
- name: Deploy whoami to swarm
@ -30,3 +22,4 @@
tags:
- docker-swarm
notify: "update upstream"