lab-ansible/roles/proxy/tasks/main.yml
2023-11-13 21:17:17 +01:00

70 lines
1.7 KiB
YAML

# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create base folder
ansible.builtin.file:
path: "{{ proxy_data_root }}"
owner: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Create folder for Caddy
ansible.builtin.file:
path: "{{ proxy_data_root }}/{{ proxy_mode }}"
owner: root
mode: u=rwx,go=
state: directory
- name: Create build folder for Caddy
ansible.builtin.file:
path: "{{ proxy_data_root }}/{{ proxy_mode }}/build"
owner: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Copy Compose file for Caddy
ansible.builtin.template:
src: docker/docker-compose.yml.j2
dest: "{{ proxy_data_root }}/{{ proxy_mode }}/docker-compose.yml"
owner: root
mode: u=rw,go=
- name: Copy Dockerfile for Caddy
ansible.builtin.template:
src: docker/Dockerfile.j2
dest: "{{ proxy_data_root }}/{{ proxy_mode }}/build/Dockerfile"
owner: root
mode: u=rw,g=r,o=r
notify: Build custom Docker image for Caddy
- name: Create data folder for Caddy
ansible.builtin.file:
path: "{{ proxy_data_root }}/{{ proxy_mode }}/data"
owner: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Copy Caddyfile
ansible.builtin.template:
src: caddy/{{ proxy_mode }}.Caddyfile.j2
dest: "{{ proxy_data_root }}/{{ proxy_mode }}/data/Caddyfile"
owner: root
mode: u=rw,go=
- name: Create subfolders for Caddy data
ansible.builtin.file:
path: "{{ proxy_data_root }}/{{ proxy_mode }}/data/caddy-{{ item }}"
owner: root
mode: u=rwx,go=
state: directory
loop:
- config
- data
- name: Copy deploy.sh
ansible.builtin.template:
src: scripts/deploy.sh.j2
dest: /usr/local/bin/deploy.sh
owner: root
mode: u=rwx,g=rx,o=rx