hosts: make a hacky, but hopefully working way of handling vpn
This isn't very clever, but it should work and be easily understandable. We likely want to come up with a better way to do these hosts files entirely, but it can wait until after freeze. Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
parent
189bf72205
commit
d36a478580
1 changed files with 22 additions and 14 deletions
|
@ -10,21 +10,29 @@
|
||||||
# Note that if it's not set it will just skip this play and do nothing.
|
# 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
|
||||||
vars:
|
copy: src={{ item }} dest=/etc/hosts
|
||||||
hosts_candidates_static:
|
with_first_found:
|
||||||
- "{{ inventory_hostname }}-hosts"
|
- "{{ inventory_hostname }}-hosts"
|
||||||
- "{{ ansible_hostname }}-hosts"
|
- "{{ ansible_hostname }}-hosts"
|
||||||
- "{{ host_group }}-hosts"
|
- "{{ host_group }}-hosts"
|
||||||
- "{{ ansible_domain }}-hosts"
|
- "{{ ansible_domain }}-hosts"
|
||||||
- "{{ datacenter }}-hosts"
|
- "{{ datacenter }}-hosts"
|
||||||
copy: src={{ item }} dest=/etc/hosts
|
- "{{ hosts_base | default('base') }}"
|
||||||
with_first_found: >-
|
when: not vpn
|
||||||
{{
|
tags:
|
||||||
(hosts_candidates_static + ["vpn"])
|
- config
|
||||||
if (vpn | default(false)) and (datacenter | default('iad2')) != 'iad2'
|
- hosts
|
||||||
else
|
|
||||||
(hosts_candidates_static + ["base"])
|
- name: setup /etc/hosts for some clients
|
||||||
}}
|
copy: src={{ item }} dest=/etc/hosts
|
||||||
|
with_first_found:
|
||||||
|
- "{{ inventory_hostname }}-hosts"
|
||||||
|
- "{{ ansible_hostname }}-hosts"
|
||||||
|
- "{{ host_group }}-hosts"
|
||||||
|
- "{{ ansible_domain }}-hosts"
|
||||||
|
- "{{ datacenter }}-hosts"
|
||||||
|
- "{{ hosts_base | default('vpn') }}"
|
||||||
|
when: vpn
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- hosts
|
- hosts
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue