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

71 lines
1.6 KiB
YAML
Raw Normal View History

2023-11-12 22:16:53 +00:00
# vim: ft=yaml.ansible
# code: language=ansible
---
2023-12-27 23:07:21 +00:00
- name: Create base directory for Caddy
2023-11-13 20:17:17 +00:00
ansible.builtin.file:
path: "{{ proxy_data_root }}"
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rwx,g=rx,o=rx
state: directory
2023-12-27 23:07:21 +00:00
- name: Create build directory for Caddy
2023-11-13 20:17:17 +00:00
ansible.builtin.file:
2023-12-22 20:57:19 +00:00
path: "{{ proxy_data_root }}/build"
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rwx,g=rx,o=rx
state: directory
- name: Copy Compose file for Caddy
ansible.builtin.template:
src: docker/docker-compose.yml.j2
2023-12-22 20:57:19 +00:00
dest: "{{ proxy_data_root }}/docker-compose.yml"
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rw,go=
- name: Copy Dockerfile for Caddy
ansible.builtin.template:
src: docker/Dockerfile.j2
2023-12-22 20:57:19 +00:00
dest: "{{ proxy_data_root }}/build/Dockerfile"
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rw,g=r,o=r
notify: Build custom Docker image for Caddy
2023-12-27 23:07:21 +00:00
- name: Create data directory for Caddy
2023-11-13 20:17:17 +00:00
ansible.builtin.file:
2023-12-22 20:57:19 +00:00
path: "{{ proxy_data_root }}/data"
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rwx,g=rx,o=rx
state: directory
2023-11-12 22:16:53 +00:00
- name: Copy Caddyfile
ansible.builtin.template:
2023-12-22 20:57:19 +00:00
src: caddy/Caddyfile.j2
dest: "{{ proxy_data_root }}/data/Caddyfile"
2023-11-12 22:16:53 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-12 22:16:53 +00:00
mode: u=rw,go=
2023-11-13 20:17:17 +00:00
2023-12-27 23:07:21 +00:00
- name: Create subdirectories for Caddy data
2023-11-13 20:17:17 +00:00
ansible.builtin.file:
2023-12-22 20:57:19 +00:00
path: "{{ proxy_data_root }}/data/caddy-{{ item }}"
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rwx,go=
state: directory
loop:
- config
- data
- name: Copy deploy.sh
ansible.builtin.template:
src: scripts/deploy.sh.j2
2023-12-28 17:59:05 +00:00
dest: /usr/bin/deploy.sh
2023-11-13 20:17:17 +00:00
owner: root
2024-01-30 18:15:51 +00:00
group: root
2023-11-13 20:17:17 +00:00
mode: u=rwx,g=rx,o=rx