From 87697ec35372f119fa969cbdd376fa26e5e68bbb Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Wed, 27 Mar 2019 07:33:30 +0000 Subject: [PATCH] Add search domains --- roles/network/templates/resolv.conf.j2 | 7 +++++++ roles/network/templates/resolved.conf.j2 | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/roles/network/templates/resolv.conf.j2 b/roles/network/templates/resolv.conf.j2 index 266321c..ca0d186 100644 --- a/roles/network/templates/resolv.conf.j2 +++ b/roles/network/templates/resolv.conf.j2 @@ -6,3 +6,10 @@ nameserver {{ ns }} {% if network_resolv_conf_options is defined %} options {{ network_resolv_conf_options | join(' ') }} {% endif %} +{% if network_search is defined %} +{% if network_search is iterable and network_search is not string %} +search {{ network_search | join(' ') }} +{% else %} +search {{ network_search }} +{% endif %} +{% endif %} diff --git a/roles/network/templates/resolved.conf.j2 b/roles/network/templates/resolved.conf.j2 index 95de57d..475cb3c 100644 --- a/roles/network/templates/resolved.conf.j2 +++ b/roles/network/templates/resolved.conf.j2 @@ -4,3 +4,10 @@ {% for ns in (network_nameservers | shuffle(seed=inventory_hostname)) %} DNS={{ ns }} {% endfor %} +{% if network_search is defined %} +{% if network_search is iterable and network_search is not string %} +Domains={{ network_search | join(' ') }} +{% else %} +Domains={{ network_search }} +{% endif %} +{% endif %}