lab-ansible/roles/proxy/tasks/main.yml

71 lines
1.6 KiB
YAML

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