-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from CiscoCloud/task/dnsmaq_setup
dnsmaq setup
- Loading branch information
Showing
10 changed files
with
145 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: restart dnsmasq | ||
sudo: yes | ||
command: systemctl 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,62 @@ | ||
--- | ||
- name: install dnsmasq and bind-utils | ||
sudo: yes | ||
yum: | ||
name: "{{ item }}" | ||
state: latest | ||
with_items: | ||
- dnsmasq | ||
- bind-utils | ||
when: inventory_hostname in groups[master_group_name] | ||
tags: | ||
- dnsmasq | ||
|
||
- name: ensure dnsmasq.d directory exists | ||
sudo: yes | ||
file: | ||
path: /etc/dnsmasq.d | ||
state: directory | ||
when: inventory_hostname in groups[master_group_name] | ||
tags: | ||
- dnsmasq | ||
|
||
- name: configure dnsmasq | ||
sudo: yes | ||
template: | ||
src: 01-kube-dns.conf.j2 | ||
dest: /etc/dnsmasq.d/01-kube-dns.conf | ||
mode: 755 | ||
notify: | ||
- restart dnsmasq | ||
when: inventory_hostname in groups[master_group_name] | ||
tags: | ||
- dnsmasq | ||
|
||
- name: enable dnsmasq | ||
sudo: yes | ||
service: | ||
name: dnsmasq | ||
state: started | ||
enabled: yes | ||
when: inventory_hostname in groups[master_group_name] | ||
tags: | ||
- dnsmasq | ||
|
||
- name: update resolv.conf with new DNS setup | ||
sudo: yes | ||
template: | ||
src: resolv.conf.j2 | ||
dest: /etc/resolv.conf | ||
mode: 644 | ||
tags: | ||
- dnsmasq | ||
|
||
- name: disable resolv.conf modification by dhclient | ||
sudo: yes | ||
lineinfile: | ||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ ansible_default_ipv4.interface }}" | ||
state: present | ||
regexp: '^PEERDNS' | ||
line: 'PEERDNS="no"' | ||
tags: | ||
- 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,13 @@ | ||
#Listen on all interfaces | ||
interface=* | ||
|
||
addn-hosts=/etc/hosts | ||
|
||
bogus-priv | ||
|
||
#Set upstream dns servers | ||
server=8.8.8.8 | ||
server=8.8.4.4 | ||
|
||
# Forward k8s domain to kube-dns | ||
server=/{{ dns_domain }}/{{ dns_server }} |
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 @@ | ||
; generated by ansible | ||
search {{ [ 'default.svc.' + dns_domain, 'svc.' + dns_domain, dns_domain ] | join(' ') }} | ||
{% for host in groups[master_group_name] %} | ||
nameserver {{ hostvars[host]['ansible_default_ipv4']['address'] }} | ||
{% endfor %} |
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,7 @@ | ||
### | ||
# kubernetes proxy config | ||
|
||
# default config should be adequate | ||
|
||
# Add your own! | ||
KUBE_PROXY_ARGS="--kubeconfig={{ kube_config_dir }}/proxy.kubeconfig" |
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,18 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
current-context: proxy-to-{{ cluster_name }} | ||
preferences: {} | ||
contexts: | ||
- context: | ||
cluster: {{ cluster_name }} | ||
user: proxy | ||
name: proxy-to-{{ cluster_name }} | ||
clusters: | ||
- cluster: | ||
certificate-authority: {{ kube_cert_dir }}/ca.crt | ||
server: https://{{ groups[master_group_name][0] }}:{{ kube_master_port }} | ||
name: {{ cluster_name }} | ||
users: | ||
- name: proxy | ||
user: | ||
token: {{ proxy_token }} |
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