Replace yml.j2 template with copy and content

This commit is contained in:
Tobias Reisinger 2025-06-11 21:23:17 +02:00
parent 36a54fef3d
commit 4cc94969f5
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
12 changed files with 41 additions and 51 deletions
playbooks
roles
backup/tasks
deploy/tasks
gatus/tasks
influxdb/tasks
lgtm_stack/tasks
loki/tasks
synapse
handlers
tasks
teamspeak_fallback/tasks
vikunja/tasks
templates

View file

@ -3,8 +3,6 @@
ansible.builtin.import_tasks: tasks/set-default-facts.yml
- name: Deploy {{ role_name }}
vars:
yml: "{{ backup_yml }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
@ -15,19 +13,17 @@
dest: "{{ (service_path, 'backup.sh') | path_join }}"
mode: "0755"
- name: Template autorestic.yml
ansible.builtin.template:
src: yml.j2
- name: Create autorestic.yml
ansible.builtin.copy:
dest: "{{ (service_path, '.autorestic.yml') | path_join }}"
content: '{{ backup_yml | to_nice_yaml }}'
mode: "0644"
- name: Template autorestic.all.yml
ansible.builtin.template:
src: yml.j2
- name: Create autorestic.all.yml
ansible.builtin.copy:
dest: "{{ (service_path, '.autorestic.all.yml') | path_join }}"
content: '{{ backup_yml_all | to_nice_yaml }}'
mode: "0644"
vars:
yml: "{{ backup_yml_all }}"
- name: Import tasks specific to the hooks scripts
ansible.builtin.import_tasks: hooks.yml

View file

@ -5,7 +5,6 @@
- name: Deploy {{ role_name }}
vars:
svc: "{{ deploy_svc }}"
yml: "{{ deploy_yml }}"
compose: "{{ deploy_compose }}"
block:
- name: Import prepare tasks for common service
@ -21,10 +20,10 @@
state: directory
mode: "0755"
- name: Template main config
ansible.builtin.template:
src: yml.j2
- name: Create main config
ansible.builtin.copy:
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
content: '{{ deploy_yml | to_nice_yaml }}'
mode: "0644"
- name: Copy the deploy-reitanlage_oranienburg script

View file

@ -5,16 +5,15 @@
- name: Deploy {{ role_name }}
vars:
svc: "{{ gatus_svc }}"
yml: "{{ gatus_yml }}"
compose: "{{ gatus_compose }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template config
ansible.builtin.template:
src: yml.j2
dest: "{{ (service_path, 'config.yaml') | path_join }}"
- name: Create config
ansible.builtin.copy:
dest: "{{ (service_path, 'config.yml') | path_join }}"
content: '{{ gatus_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}

View file

@ -7,16 +7,15 @@
svc: "{{ influxdb_svc }}"
env: "{{ influxdb_env }}"
compose: "{{ influxdb_compose }}"
yml: "{{ influxdb_yml }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template config
ansible.builtin.template:
src: yml.j2
- name: Create config
ansible.builtin.copy:
dest: "{{ (service_path, 'influxdb.yml') | path_join }}"
mode: "0600"
content: '{{ influxdb_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}
- name: Import start tasks for common service

View file

@ -8,10 +8,8 @@
state: directory
mode: "0755"
- name: Template default datasources
ansible.builtin.template:
src: yml.j2
- name: Create default datasources
ansible.builtin.copy:
dest: "{{ (datasources_path, 'default.yaml') | path_join }}"
content: '{{ lgtm_stack_grafana_datasources | to_nice_yaml }}'
mode: "0644"
vars:
yml: "{{ lgtm_stack_grafana_datasources }}"

View file

@ -21,13 +21,11 @@
mode: "0644"
notify: Restart service {{ role_name }}
- name: Template mimir config file
ansible.builtin.template:
src: yml.j2
- name: Create mimir config
ansible.builtin.copy:
dest: "{{ (service_path, 'mimir.yaml') | path_join }}"
content: '{{ lgtm_stack_mimir_yml | to_nice_yaml }}'
mode: "0644"
vars:
yml: "{{ lgtm_stack_mimir_yml }}"
notify: Restart service {{ role_name }}
- name: Import start tasks for common service

View file

@ -5,16 +5,15 @@
- name: Deploy {{ role_name }}
vars:
svc: "{{ loki_svc }}"
yml: "{{ loki_yml }}"
compose: "{{ loki_compose }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template loki config file
ansible.builtin.template:
src: yml.j2
- name: Create loki config
ansible.builtin.copy:
dest: "{{ (service_path, 'loki.yaml') | path_join }}"
content: '{{ loki_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}

View file

@ -0,0 +1,3 @@
---
- name: Restart service {{ role_name }}
ansible.builtin.include_tasks: tasks/restart-service.yml

View file

@ -7,7 +7,6 @@
svc: "{{ synapse_svc }}"
env: "{{ synapse_env }}"
compose: "{{ synapse_compose }}"
yml: "{{ synapse_yml }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
@ -22,23 +21,26 @@
state: directory
mode: "0755"
- name: Template config
ansible.builtin.template:
src: yml.j2
- name: Create config
ansible.builtin.copy:
dest: "{{ (config_path, 'homeserver.yaml') | path_join }}"
content: '{{ synapse_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}
- name: Copy the log config
ansible.builtin.copy:
src: msrg.cc.log.config
dest: "{{ (config_path, 'msrg.cc.log.config') | path_join }}"
mode: "0644"
notify: Restart service {{ role_name }}
- name: Copy the signing key
ansible.builtin.copy:
content: "{{ vault_synapse.signing_key }}"
dest: "{{ (config_path, 'msrg.cc.signing.key') | path_join }}"
mode: "0644"
notify: Restart service {{ role_name }}
- name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -7,7 +7,6 @@
svc: "{{ teamspeak_fallback_svc }}"
compose: "{{ teamspeak_fallback_compose }}"
env: "{{ teamspeak_fallback_env }}"
yml: "{{ teamspeak_fallback_yml }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
@ -28,10 +27,10 @@
state: directory
mode: "0755"
- name: Template main config
ansible.builtin.template:
src: yml.j2
- name: Create main config
ansible.builtin.copy:
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
content: '{{ teamspeak_fallback_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}

View file

@ -5,16 +5,15 @@
- name: Deploy {{ role_name }}
vars:
svc: "{{ vikunja_svc }}"
yml: "{{ vikunja_yml }}"
compose: "{{ vikunja_compose }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template config
ansible.builtin.template:
src: yml.j2
- name: Create config
ansible.builtin.copy:
dest: "{{ (service_path, 'config.yml') | path_join }}"
content: '{{ vikunja_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}

View file

@ -1 +0,0 @@
{{ yml | to_nice_yaml }}