-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tk
committed
Mar 5, 2019
1 parent
8eb21d9
commit ae78ef0
Showing
1 changed file
with
78 additions
and
5 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 |
---|---|---|
@@ -1,9 +1,82 @@ | ||
Role Name | ||
========= | ||
|
||
# ansible-consul-pdns-recursor | ||
pdns-recursor for consul | ||
pdns-recursor for consul. | ||
dnsmasq server=/consul/127.0.0.1#8600 does not use TTL. | ||
|
||
|
||
### sample | ||
1. install pdns-recursor | ||
2. set forward-zones-recurse=consul=127.0.0.1:8600 to recursor.conf | ||
3. start pdns-recursor | ||
4. disalbe NetworkManager update resolv.conf | ||
5. update resolv.conf (nameserver 127.0.0.1) | ||
|
||
## Setup consul sample | ||
``` | ||
- hosts: pdns-recursor | ||
roles: | ||
- pdns-recursor | ||
### requirements.yml | ||
- src: brianshumate.consul | ||
version: v2.3.2 | ||
### install brianshumate.consul | ||
# ansible-galaxy install -r requirements.yml | ||
### edit hosts inventory | ||
[consul_instances] | ||
project01 consul_node_role=bootstrap ansible_host=10.1.1.10 | ||
flash01 consul_node_role=server ansible_host=10.1.1.11 | ||
flash02 consul_node_role=server ansible_host=10.1.1.12 | ||
template ansible_host=10.1.1.254 template=true | ||
cache01 ansible_host=10.1.1.30 | ||
cache02 ansible_host=10.1.1.31 | ||
### plyabook for consul | ||
- hosts: consul_instances | ||
vars: | ||
consul_bind_address: "{{ ansible_host }}" | ||
consul_datacenter: "chocotto" | ||
consul_enable_script_checks: true | ||
consul_config_custom: | ||
dns_config: | ||
service_ttl: | ||
"*": "5s" | ||
roles: | ||
- brianshumate.consul | ||
### for autoscale template | ||
post_tasks: | ||
- name: Delete Line | ||
lineinfile: | ||
path: "/etc/consul/config.json" | ||
regexp: "{{ item }}" | ||
state: "absent" | ||
backup: "yes" | ||
with_items: | ||
- "advertise_addr" | ||
- "advertise_addr_wan" | ||
- "node_name" | ||
- "bind_addr" | ||
when: template is defined | ||
``` | ||
|
||
Requirements | ||
------------ | ||
None | ||
|
||
Role Variables | ||
-------------- | ||
None | ||
|
||
Dependencies | ||
------------ | ||
None | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
- hosts: servers | ||
roles: | ||
- ysakkk.ansible_consul_pdns_recursor | ||
|