From 8ee9c66072a73e96ed14d07596de7bf1ce25a541 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Mon, 5 Apr 2021 10:15:52 -0700 Subject: [PATCH] hosts: try again as the last simple fix was too simple So, we need a bit more logic here. We want to use the vpn hosts file only if something is on the vpn and it's also not in iad2. In iad2 we want the normal hosts file. Signed-off-by: Kevin Fenzi --- roles/hosts/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/hosts/tasks/main.yml b/roles/hosts/tasks/main.yml index 920caa98cd..538e337e99 100644 --- a/roles/hosts/tasks/main.yml +++ b/roles/hosts/tasks/main.yml @@ -9,7 +9,7 @@ # This will move a /etc/hosts in place if it's setup in files for that host/domain # Note that if it's not set it will just skip this play and do nothing. # -- name: setup /etc/hosts for some clients +- name: setup /etc/hosts for some clients that are not on the vpn or are and in iad2 copy: src={{ item }} dest=/etc/hosts with_first_found: - "{{ inventory_hostname }}-hosts" @@ -18,12 +18,12 @@ - "{{ ansible_domain }}-hosts" - "{{ datacenter }}-hosts" - "{{ hosts_base | default('base') }}" - when: not vpn + when: not vpn or ( vpn and datacenter == 'iad2' ) tags: - config - hosts -- name: setup /etc/hosts for some clients +- name: setup /etc/hosts for some clients on the vpn, that are not in iad2 copy: src={{ item }} dest=/etc/hosts with_first_found: - "{{ inventory_hostname }}-hosts" @@ -32,7 +32,7 @@ - "{{ ansible_domain }}-hosts" - "{{ datacenter }}-hosts" - "{{ hosts_base | default('vpn') }}" - when: vpn + when: vpn and datacenter != 'iad2' tags: - config - hosts