No need to specify file in dict

This commit is contained in:
Sam A. 2022-12-26 00:29:46 +01:00
parent 123276b3de
commit 9bae994269
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
2 changed files with 5 additions and 15 deletions

View file

@ -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

View file

@ -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