From b7ca1b5c2275a9c571712c88342a9648cc8c08ae Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 4 Jul 2018 18:39:38 +0200 Subject: [PATCH] Failed attempt to automatically setup a different list of resolvers. --- ubuntu-deb-general/defaults/main.yml | 15 ++++++--------- ubuntu-deb-general/tasks/resolvconf.yml | 10 ++++++++-- ubuntu-deb-general/templates/resolv.conf | 9 +++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ubuntu-deb-general/defaults/main.yml b/ubuntu-deb-general/defaults/main.yml index 319e9d4f..3ce00352 100644 --- a/ubuntu-deb-general/defaults/main.yml +++ b/ubuntu-deb-general/defaults/main.yml @@ -100,19 +100,16 @@ pki_subdirs: # Install our /etc/resolv.conf install_resolvconf: True -resolv_conf_domain: d4science.org +resolv_conf_domain: example.org +resolv_conf_use_openstack_settings: True resolv_conf_search: - - 'd4science.org' - - 'd4science.net' - - 'd4science.eu' - - 'research-infrastructures.eu' - - 'isti.cnr.it' + - 'example.org' + - 'example.com' resolv_conf_ip: - - '146.48.122.10' - - '146.48.80.4' - - '146.48.80.3' + - '8.8.8.8' + - '1.1.1.1' # Install nscd if requested install_nscd: False diff --git a/ubuntu-deb-general/tasks/resolvconf.yml b/ubuntu-deb-general/tasks/resolvconf.yml index cf7554e3..9009f8c3 100644 --- a/ubuntu-deb-general/tasks/resolvconf.yml +++ b/ubuntu-deb-general/tasks/resolvconf.yml @@ -1,6 +1,12 @@ --- -- name: Install the system resolv.conf - template: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 +- block: + # - name: Find the Openstack region, if any + # set_fact: openstack_region_name={{ location.region_name|replace('-','_') }} cacheable=True + # when: location.region_name is defined + + - name: Install the system resolv.conf + template: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 + when: install_resolvconf tags: resolvconf diff --git a/ubuntu-deb-general/templates/resolv.conf b/ubuntu-deb-general/templates/resolv.conf index 0fdd8ade..d0aca4ff 100644 --- a/ubuntu-deb-general/templates/resolv.conf +++ b/ubuntu-deb-general/templates/resolv.conf @@ -4,6 +4,15 @@ domain {{ resolv_conf_domain }} {% if resolv_conf_search is defined %} search {% for dom in resolv_conf_search %} {{ dom }}{% endfor %} {% endif %} + +# {% if resolv_conf_use_openstack_settings and openstack_region_name is defined %} +# {% for ip in ['resolv_conf_ip_' + 'openstack_region_name'] %} +# nameserver {{ ip }} +# {% endfor %} +# {% else %} + {% for address in resolv_conf_ip %} nameserver {{ address }} {% endfor %} + +# {% endif %}