added role for configuring resolv.conf
diff --git a/roles/dns-configure/defaults/main.yml b/roles/dns-configure/defaults/main.yml
new file mode 100644
index 0000000..f17d1fa
--- /dev/null
+++ b/roles/dns-configure/defaults/main.yml
@@ -0,0 +1,9 @@
+---
+# roles/dns-configure/defaults
+
+dns_servers:
+ - 8.8.8.8
+ - 8.8.4.4
+
+dns_search: {}
+
diff --git a/roles/dns-configure/tasks/main.yml b/roles/dns-configure/tasks/main.yml
new file mode 100644
index 0000000..2c529bc
--- /dev/null
+++ b/roles/dns-configure/tasks/main.yml
@@ -0,0 +1,9 @@
+---
+# roles/dns-configure/tasks.yml
+
+- name: Configure resolv.conf to use nameservers
+ template:
+ src="resolv.conf.j2"
+ dest="/etc/resolv.conf"
+ mode=0644 owner=root group=root
+
diff --git a/roles/dns-configure/templates/resolv.conf.j2 b/roles/dns-configure/templates/resolv.conf.j2
new file mode 100644
index 0000000..a6bd8ea
--- /dev/null
+++ b/roles/dns-configure/templates/resolv.conf.j2
@@ -0,0 +1,7 @@
+# resolv.conf (ansible managed)
+{% for ns in dns_servers %}
+nameserver {{ ns }}
+{% endfor %}
+{% if dns_search is defined %}
+search{% for searchdom in dns_search %} {{ searchdom }}{% endfor %}
+{% endif %}