From ddef2e7651e580a9d4fb692ee6ff5a0a156bea17 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Wed, 28 Dec 2022 21:17:33 +0100 Subject: [PATCH] Adapt hosts for testing --- playbooks/system.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/playbooks/system.yml b/playbooks/system.yml index 0605294..f1143a6 100644 --- a/playbooks/system.yml +++ b/playbooks/system.yml @@ -6,7 +6,10 @@ - name: "block domains" ansible.builtin.lineinfile: path: "/etc/hosts" - line: "127.0.0.1 {{ item }}" + line: "{{ address }} {{ item }}" + vars: + - address: "{{ hostvars[item.split('.')[0]].ansible_default_ipv4.address | + default('127.0.0.1') }}" loop: "{{ [system_mail_smtp_server | default([])] | union( [vpn_wireguard_server_address | default([])] ) | union( [services_backups_restic_aws_bucket_endpoint | default([])] ) |