From d63c9b0748c6b0dd7206a00a1d19cb981d7ce2bf Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Sun, 3 Jul 2016 21:01:28 +1200 Subject: [PATCH] edited hosts template to allow for vendor overrid/addition of named hosts to hosts file. --- templates/etc.hosts.j2 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/etc.hosts.j2 b/templates/etc.hosts.j2 index 1b2b9e9..b74a1e9 100644 --- a/templates/etc.hosts.j2 +++ b/templates/etc.hosts.j2 @@ -6,8 +6,16 @@ {{ ansible_default_ipv4.address }} {{ ansible_hostname }}.{{ domain }} {{ ansible_hostname }} -{% if not vendors_hosts is none %} - {% for item in vendors_hosts %} +{# note: below block takes a list of ip -> name mappings + applying them to the hosts file should the variable be + populated. +#} +{% if vendors_hosts %} +#*** Vendor Additional Host Entries ***# + +{% for item in vendors_hosts %} {{ item.ip }} {{ item.name }} - {% endfor %} +{% endfor %} + +#*** END Vendor Additional Host Entries ***# {% endif %}