hosts: do the right thing for VPN hosts

Move the vpn ./. base logic from the ipa/client role into the hosts
role, so that applying the latter doesn't apply the base profile on VPN
hosts.

Fixes: fedora-infrastructure#9822

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2021-04-01 16:27:57 +02:00
parent 6811f7df63
commit 7a2024398f
2 changed files with 14 additions and 10 deletions

View file

@ -10,14 +10,21 @@
# 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:
hosts_candidates_static:
- "{{ inventory_hostname }}-hosts"
- "{{ ansible_hostname }}-hosts"
- "{{ host_group }}-hosts"
- "{{ ansible_domain }}-hosts"
- "{{ datacenter }}-hosts"
copy: src={{ item }} dest=/etc/hosts copy: src={{ item }} dest=/etc/hosts
with_first_found: with_first_found: >-
- "{{ inventory_hostname }}-hosts" {{
- "{{ ansible_hostname }}-hosts" (hosts_candidates_static + ["vpn"])
- "{{ host_group }}-hosts" if (vpn | default(false)) and (datacenter | default('iad2')) != 'iad2'
- "{{ ansible_domain }}-hosts" else
- "{{ datacenter }}-hosts" (hosts_candidates_static + ["base"])
- "{{ hosts_base | default('base') }}" }}
tags: tags:
- config - config
- hosts - hosts

View file

@ -1,6 +1,5 @@
--- ---
- name: Install /etc/hosts for VPN clients - name: Install /etc/hosts for VPN clients
when: "(vpn | default(false)) and (datacenter | default('iad2')) != 'iad2'"
include_role: include_role:
name: hosts name: hosts
apply: apply:
@ -8,5 +7,3 @@
- ipa/client - ipa/client
- config - config
- vpn-client-enablement - vpn-client-enablement
vars:
hosts_base: vpn