localservices/tasks/main.yml

44 lines
1.2 KiB
YAML

---
- name: "set local variables from overrides and defaults"
set_fact:
localservices: "{{ (localservices_defaults | combine(localservices_override, recursive=True)) if localservices_override else localservices_defaults }}"
- name: ensure that path exists
file:
path: "{{ path }}/config/wg_confs"
state: directory
- import_role:
name: storage_mount
vars:
storage_mount_override:
host: "{{ localservices.networkmount.host }}"
host_path: "{{ localservices.networkmount.host_path }}"
args: "{{ localservices.networkmount.args }}"
dest_path: "{{ localservices.networkmount.dest_path }}"
when: localservices.networkmount.host | length > 1
- name: write wg0.conf
copy:
content: "{{ localservices.wg_client.wg_conf }}"
dest: "{{ path }}/config/wg0.conf"
- name: template i2psnark.conf
template:
src: "i2psnark.conf.j2"
dest: "{{ path }}/config/i2psnark.config"
when: localservices.i2psnark.url | length > 0
- name: template docker compose
template:
src: "compose.yml.j2"
dest: "{{ path }}/compose.yml"
- name: ensure everything is up
community.docker.docker_compose_v2:
project_src: "{{ path }}"
project_name: "{{ role_name }}"
recreate: always
state: "present"