-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new resolver role, which configures dnsmasq to use the nameserv…
…ers listed in group_vars for a cluster.
- Loading branch information
Showing
8 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: cluster | ||
roles: | ||
- resolver | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# | ||
# Important: maintain correct handler order. | ||
# Handlers are executed in the order in which they are defined | ||
# and not in the order in whch they are listed in a "notify: handler_name" statement! | ||
# | ||
- name: Restart dnsmasq service. | ||
service: | ||
name: dnsmasq | ||
state: restarted | ||
become: true | ||
listen: restart_dnsmasq | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- name: Install dnsmasq | ||
yum: | ||
state: latest | ||
update_cache: yes | ||
name: | ||
- dnsmasq | ||
become: true | ||
notify: restart_dnsmasq | ||
|
||
- name: Configure /etc/dnsmasq.conf to use nameservers as listed in group_vars for this cluster. | ||
template: | ||
dest: '/etc/dnsmasq.conf' | ||
src: 'templates/dnsmasq.conf.j2' | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
become: true | ||
notify: restart_dnsmasq | ||
|
||
- name: Configure /etc/resolv.conf to use dnsmasq on localhost. | ||
copy: | ||
dest: '/etc/resolv.conf' | ||
content: nameserver 127.0.0.1 | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
become: true | ||
notify: restart_dnsmasq | ||
|
||
- name: Enable dnsmasq service. | ||
systemd: | ||
name: 'dnsmasq.service' | ||
enabled: yes | ||
become: true | ||
notify: restart_dnsmasq | ||
|
||
- meta: flush_handlers | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for nameserver in nameservers %} | ||
server={{ nameserver }} | ||
{% endfor %} |