Extract tasks to be included

This commit is contained in:
Tobias Reisinger 2023-06-13 22:36:13 +02:00
parent 872f545c64
commit 13cf7a05ee
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
6 changed files with 37 additions and 46 deletions

View file

@ -1,36 +1,24 @@
---
- name: Deploy acme-dns
tags: acme-dns
vars:
service_path: "{{ (services_path, svc.name) | path_join }}"
config_path: "{{ (service_path, 'config') | path_join }}"
block:
- name: Create a service directory for {{ svc.name }}
ansible.builtin.file:
path: "{{ service_path }}"
state: directory
mode: "0755"
- import_tasks: create-service-directory.yml
- import_tasks: template-docker-compose.yml
- name: Create a service-config directory for {{ svc.name }}
- name: Setting the service config path
ansible.builtin.set_fact:
config_path: "{{ (service_path, 'config') | path_join }}"
- name: Create a service-config directory
ansible.builtin.file:
path: "{{ config_path }}"
state: directory
mode: "0700"
- name: Template docker-compose for {{ svc.name }}
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
mode: "0644"
- name: Template config for {{ svc.name }}
- name: Template config
ansible.builtin.template:
src: config.cfg.j2
dest: "{{ (config_path, 'config.cfg') | path_join }}"
mode: "0600"
- name: Template caddy config for {{ svc.name }}
ansible.builtin.template:
src: caddy_site.conf.j2
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
mode: "0644"
- import_tasks: template-site-config.yml

View file

@ -3,29 +3,8 @@
tags:
- analytics
- umami
vars:
service_path: "{{ (services_path, svc.name) | path_join }}"
block:
- name: Create a service directory for {{ svc.name }}
ansible.builtin.file:
path: "{{ service_path }}"
state: directory
mode: "0755"
- name: Template docker-compose for {{ svc.name }}
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
mode: "0644"
- name: Template service.env file for {{ svc.name }}
ansible.builtin.template:
src: service.env.j2
dest: "{{ (service_path, 'service.env') | path_join }}"
mode: "0600"
- name: Template caddy config for {{ svc.name }}
ansible.builtin.template:
src: caddy_site.conf.j2
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
mode: "0644"
- import_tasks: create-service-directory.yml
- import_tasks: template-docker-compose.yml
- import_tasks: template-service-env.yml
- import_tasks: template-site-config.yml

View file

@ -0,0 +1,9 @@
- name: Setting the service path
ansible.builtin.set_fact:
service_path: "{{ (services_path, svc.name) | path_join }}"
- name: Create a service directory
ansible.builtin.file:
path: "{{ service_path }}"
state: directory
mode: "0755"

View file

@ -0,0 +1,5 @@
- name: Template docker-compose
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
mode: "0644"

View file

@ -0,0 +1,5 @@
- name: Template service.env file
ansible.builtin.template:
src: service.env.j2
dest: "{{ (service_path, 'service.env') | path_join }}"
mode: "0600"

View file

@ -0,0 +1,5 @@
- name: Template caddy config
ansible.builtin.template:
src: caddy_site.conf.j2
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
mode: "0644"