From 9bae9942693e0d6d47b50f111e40da4abc5c9324 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Mon, 26 Dec 2022 00:29:46 +0100 Subject: [PATCH] No need to specify file in dict --- roles/docker/defaults/main.yml | 8 -------- roles/docker/tasks/services.yml | 12 +++++------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 5f5a552..ad7b432 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -5,21 +5,17 @@ base_volume: "{{ hdd_mount_point }}/apps" services: caddy: - file: caddy.yml volume: "{{ base_volume }}/caddy" version: 2-alpine watchtower: - file: watchtower.yml version: arm64v8-1.5.1 restic: - file: restic.yml repo: /restic version: 1.6 nextcloud: - file: nextcloud.yml domain: "cloud.{{ base_domain }}" volume: "{{ base_volume }}/nextcloud" version: 25-apache @@ -27,23 +23,19 @@ services: redis_version: 7-alpine emby: - file: emby.yml domain: "watch.{{ base_domain }}" volume: "{{ base_volume }}/emby" version: latest monerod: - file: monerod.yml domain: "xmr.{{ base_domain }}" version: latest wireguard: - file: wireguard.yml domain: "wg01.vpn.{{ base_domain }}" volume: "{{ base_volume }}/wireguard" port: 51820 version: arm64v8-alpine snowflake: - file: snowflake.yml version: latest diff --git a/roles/docker/tasks/services.yml b/roles/docker/tasks/services.yml index bf62699..be74cfe 100644 --- a/roles/docker/tasks/services.yml +++ b/roles/docker/tasks/services.yml @@ -25,13 +25,11 @@ state: directory - name: Deploy services - include_tasks: "services/{{ item.service.file }}" - loop: "{{ services | dict2items(value_name='service') }}" - when: single_service is not defined and - item.service.file is defined + include_tasks: "services/{{ item.service }}.yml" + loop: "{{ services | dict2items(key_name='service') }}" + when: single_service is not defined - name: Deploy single service - include_tasks: "services/{{ services[single_service].file }}" + include_tasks: "services/{{ single_service }}.yml" when: single_service is defined and - single_service in services and - services[single_service].file is defined + single_service in services