Separate caddy container id grabbing into own role
Since other roles often rely on this not an actual new caddy server installation we should probably have it as its own little role.
This commit is contained in:
parent
a52cab2f61
commit
388a1d8cfc
8 changed files with 246 additions and 41 deletions
|
|
@ -5,9 +5,9 @@
|
|||
ansible.builtin.file:
|
||||
path: "{{ caddy_caddyfile_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
become: true
|
||||
tags:
|
||||
tags:
|
||||
- fs
|
||||
|
||||
- name: Ensure Caddyfile exists
|
||||
|
|
@ -30,44 +30,6 @@
|
|||
become: true
|
||||
tags:
|
||||
- docker-swarm
|
||||
|
||||
- name: Get caddy container info
|
||||
ansible.builtin.command:
|
||||
cmd: docker ps -q -f name={{ caddy_stack.name }}
|
||||
become: true
|
||||
# bringing up the container takes some time, we have to wait
|
||||
until: caddy_container_info['rc'] == 0 and caddy_container_info['stdout'] | length >= 1
|
||||
retries: 5
|
||||
delay: 10
|
||||
changed_when: False
|
||||
register: caddy_container_info
|
||||
|
||||
- name: Register caddy container id
|
||||
ansible.builtin.set_fact: caddy_container_id={{ caddy_container_info['stdout'] }}
|
||||
notify:
|
||||
- debug caddy container
|
||||
|
||||
# FIXME this should be taken care of in Dockerfile not here
|
||||
- name: Ensure caddy curl available
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
apk add curl
|
||||
become: true
|
||||
register: result
|
||||
changed_when: "'Installing' in result.stdout"
|
||||
|
||||
- name: Ensure caddy api is responsive
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl localhost:2019/config/
|
||||
become: true
|
||||
until: result.rc == 0
|
||||
when: caddy_use_api == True
|
||||
changed_when: False
|
||||
register: result
|
||||
|
||||
# TODO FIXME UP
|
||||
# - name: Allow access to services
|
||||
# firewalld:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue