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 %}