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

70 lines
1.7 KiB
YAML
Raw Normal View History

2023-11-12 22:16:53 +00:00
# vim: ft=yaml.ansible
# code: language=ansible
---
2023-11-13 20:17:17 +00:00
- 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
2023-11-12 22:16:53 +00:00
- name: Copy Caddyfile
ansible.builtin.template:
src: caddy/{{ proxy_mode }}.Caddyfile.j2
2023-11-13 20:17:17 +00:00
dest: "{{ proxy_data_root }}/{{ proxy_mode }}/data/Caddyfile"
2023-11-12 22:16:53 +00:00
owner: root
mode: u=rw,go=
2023-11-13 20:17:17 +00:00
- 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