From 4ec9d5ef96220c7689c981e6fe2cd0f66df6dd44 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Tue, 20 Dec 2022 18:56:02 +0100 Subject: [PATCH] Cleverer loop --- playbooks/system.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/system.yml b/playbooks/system.yml index 7a21a5a..555cea4 100644 --- a/playbooks/system.yml +++ b/playbooks/system.yml @@ -7,10 +7,10 @@ ansible.builtin.lineinfile: path: "/etc/hosts" line: "127.0.0.1 {{ item }}" - loop: - - "{{ system_mail_smtp_server }}" - - "{{ vpn_wireguard_server_address | default('localhost') }}" - - "{{ services_backups_restic_aws_bucket_endpoint | default('localhost') }}" + loop: "{{ [system_mail_smtp_server | default([])] | + union( [vpn_wireguard_server_address | default([])] ) | + union( [services_backups_restic_aws_bucket_endpoint | default([])] ) | + flatten }}" when: not (the_nine_worlds_production | bool) tags: "always"