From 3ef6eaf3a97d5df1a9469fcbe156ef0f2760b1a4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 4 May 2018 19:47:39 +0200 Subject: [PATCH] The resolv.conf file is now parametric. --- ubuntu-deb-general/defaults/main.yml | 13 +++++++++++++ ubuntu-deb-general/tasks/resolvconf.yml | 2 +- ubuntu-deb-general/templates/resolv.conf | 13 +++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ubuntu-deb-general/defaults/main.yml b/ubuntu-deb-general/defaults/main.yml index bb76fb2d..319e9d4f 100644 --- a/ubuntu-deb-general/defaults/main.yml +++ b/ubuntu-deb-general/defaults/main.yml @@ -100,6 +100,19 @@ pki_subdirs: # Install our /etc/resolv.conf install_resolvconf: True +resolv_conf_domain: d4science.org + +resolv_conf_search: + - 'd4science.org' + - 'd4science.net' + - 'd4science.eu' + - 'research-infrastructures.eu' + - 'isti.cnr.it' + +resolv_conf_ip: + - '146.48.122.10' + - '146.48.80.4' + - '146.48.80.3' # Install nscd if requested install_nscd: False diff --git a/ubuntu-deb-general/tasks/resolvconf.yml b/ubuntu-deb-general/tasks/resolvconf.yml index fbc5e6ad..3008d861 100644 --- a/ubuntu-deb-general/tasks/resolvconf.yml +++ b/ubuntu-deb-general/tasks/resolvconf.yml @@ -1,6 +1,6 @@ --- - name: Install the system resolv.conf - copy: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 + template: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 when: install_resolvconf diff --git a/ubuntu-deb-general/templates/resolv.conf b/ubuntu-deb-general/templates/resolv.conf index ce12b53a..0fdd8ade 100644 --- a/ubuntu-deb-general/templates/resolv.conf +++ b/ubuntu-deb-general/templates/resolv.conf @@ -1,4 +1,9 @@ -search d4science.org d4science.net research-infrastructures.eu isti.cnr.it -nameserver 146.48.122.10 -nameserver 146.48.80.4 -nameserver 146.48.80.3 +{% if resolv_conf_domain is defined %} +domain {{ resolv_conf_domain }} +{% endif %} +{% if resolv_conf_search is defined %} +search {% for dom in resolv_conf_search %} {{ dom }}{% endfor %} +{% endif %} +{% for address in resolv_conf_ip %} +nameserver {{ address }} +{% endfor %}