cloudserve-infrastructure/roles/caddy/tasks/main.yml
Marty Oehme 388a1d8cfc
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.
2023-12-08 20:35:51 +01:00

44 lines
960 B
YAML

---
# install caddy as a docker stack
- name: Ensure Caddyfile directory exists
ansible.builtin.file:
path: "{{ caddy_caddyfile_dir }}"
state: directory
mode: "0755"
become: true
tags:
- fs
- name: Ensure Caddyfile exists
ansible.builtin.template:
src: config.json.j2
dest: "{{ caddy_caddyfile_dir }}/config.json"
validate: "docker run --rm -v %s:/config.json peterdavehello/jsonlint jsonlint -q /config.json"
become: true
tags:
- fs
- name: Deploy caddy to swarm
community.general.docker_stack:
name: "{{ caddy_stack.name }}"
state: present
prune: yes
compose:
- "{{ caddy_stack.compose }}"
when: caddy_stack is defined
become: true
tags:
- docker-swarm
# TODO FIXME UP
# - name: Allow access to services
# firewalld:
# service: "{{ item }}"
# permanent: true
# state: enabled
# with_items:
# - http
# - https
# become: true
# tags:
# - firewall