From: Christian Pointner Date: Sun, 22 Apr 2018 11:59:37 +0000 (+0200) Subject: ansible: first proposl for nicer inventory names X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=8b725abbd453499388e1108987d951a023ab29c5;p=noc.git ansible: first proposl for nicer inventory names --- diff --git a/ansible/hosts.ini b/ansible/hosts.ini index b618973..a741934 100644 --- a/ansible/hosts.ini +++ b/ansible/hosts.ini @@ -3,23 +3,38 @@ host_domain=realraum.at ansible_host={{ inventory_hostname }}.{{ host_domain }} ansible_user=root +[net-zone-mgmt] +#torwaechter +alfred +calendar +galley +hacksch +## TODO: remove the variable once https://github.com/ansible/ansible/issues/39119 is fixed +metrics localconfig_ssh_config_user=root +r3home +tickets + +[net-zone-mgmt:vars] +host_domain=mgmt.realraum.at + +########################## + [baremetalservers] -alfred.mgmt +alfred [kvmhosts] -alfred.mgmt +alfred [virtualservers] athsdisc -calendar.mgmt +calendar ctf entrance -galley.mgmt -hacksch.mgmt -## TODO: remove the variable once https://github.com/ansible/ansible/issues/39119 is fixed -metrics.mgmt localconfig_ssh_config_user=root -r3home.mgmt -tickets.mgmt +galley +hacksch +metrics +r3home +tickets vex [servers:children] @@ -33,7 +48,7 @@ wuerfel #[alix] #gw -#torwaechter.mgmt +#torwaechter #[apu] #gnocchi1 diff --git a/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 b/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 index ba11160..dd33944 100644 --- a/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 +++ b/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 @@ -2,12 +2,11 @@ # realraum ssh-config (generated by ansible NOC repo) ####################################### -### dynamically generated hosts +### dynamically generated host configs {% for host in (groups['all'] | sort) %} -{% set shortname = (host.split('.') | first) %} -Host {{ host }}.realraum.at r3-{{ shortname }} r3g-{{ shortname }} r3e-{{ shortname }} - Hostname {{ host }}.realraum.at +Host {{ hostvars[host].ansible_host }} r3-{{ host }} r3g-{{ host }} r3e-{{ host }} + Hostname {{ hostvars[host].ansible_host }} {% if 'localconfig_ssh_config_proxycommand' in hostvars[host] %} ProxyCommand {{ hostvars[host].localconfig_ssh_config_proxycommand }} {% endif %}