diff --git a/tasks/configure.yml b/tasks/configure.yml index 922d83d..8e55191 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -64,8 +64,8 @@ - name: Configure peers hosts file entry lineinfile: path: /etc/hosts - regexp: "^{{ item['AllowedIPs'] | regex_replace('/.*$', '')}} " - line: "{{ item['AllowedIPs'] | regex_replace('/.*$', '')}} {{ item['name'] }}.{{ vpn_domain }}" + regexp: "^{{ hostvars[item]['AllowedIPs'] | regex_replace('/.*$', '')}} " + line: "{{ hostvars[item]['AllowedIPs'] | regex_replace('/.*$', '')}} {{ item }}.{{ vpn_domain }}" backup: true create: true loop: "{{ groups['wireguard_clients'] }}"