From aab7e759725cd716ca1a9d54f104e562d8486128 Mon Sep 17 00:00:00 2001
From: Nigel Gibbs <nigel@gibbsoft.com>
Date: Tue, 16 Feb 2016 23:50:57 +0000
Subject: [PATCH] Added support for DNS resolver options. See the [resolv.conf
 man page](https://www.cl.cam.ac.uk/cgi-bin/manpage?5+resolv.conf) for more
 info.

---
 .gitignore               | 1 +
 README.md                | 5 +++--
 defaults/main.yml        | 5 +++--
 templates/resolv.conf.j2 | 4 ++++
 4 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e43b0f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/README.md b/README.md
index 7607e55..eca5eb7 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Ansible role for configure DNS
 # Examples :
 ```
 - hosts: all
-  roles: 
+  roles:
   - role: ansible-role-dns
     dns_domain: localdomain
     dns_nameservers: ['127.0.0.1', '8.8.8.8']
@@ -15,6 +15,7 @@ Ansible role for configure DNS
   roles:
   - role: ansible-role-dns
     dns_nameservers: ['8.8.8.8']  
-    dns_searchs: ['localdomain', 'otherdomain']
+    dns_searchs: "localdomain otherdomain"
+    dns_options: ['timeout:3', 'attempts:5']
 
 ```
diff --git a/defaults/main.yml b/defaults/main.yml
index 5a8cfc7..7aa4a42 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -2,8 +2,9 @@
 dns_nameservers: ['8.8.8.8', '8.8.4.4']
 dns_remove_resolvconf: true
 dns_domain: "localdomain"
-dns_searchs: 
-   - "{{dns_domain}}"
+dns_searchs:
+  - "{{dns_domain}}"
+dns_options: []
 dns_dhclient_rule: "supersede" # can be supersede or prepend
 
 dns_dhclient_file: "/etc/dhcp/dhclient.conf"
diff --git a/templates/resolv.conf.j2 b/templates/resolv.conf.j2
index e54ea16..cefad9d 100644
--- a/templates/resolv.conf.j2
+++ b/templates/resolv.conf.j2
@@ -8,3 +8,7 @@ nameserver {{nameserver}}
 {% if dns_searchs is defined %}
 search {% for name in dns_searchs %}{{name}} {% endfor %}
 {% endif %}
+
+{% for options in dns_options %}
+options {{options}}
+{% endfor %}