-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
28 changed files
with
315 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
coredns_dynamic_enabled: no | ||
coredns_dynamic_domain: dynamic.internal | ||
# coredns_dynamic_http_port: | ||
# coredns_dynamic_secret: | ||
coredns_dynamic_timeout: 2m |
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,10 @@ | ||
[Unit] | ||
Description=Coredns serivce discovery and dns server | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/coredns -conf /etc/coredns/Corefile | ||
WorkingDirectory=/etc/coredns | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,2 @@ | ||
dependencies: | ||
- name: cs.repo-mageops |
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,32 @@ | ||
- name: Update dhclient config | ||
template: | ||
dest: /etc/dhcp/dhclient.conf | ||
src: dhclient.conf.j2 | ||
register: _update_dhclient | ||
|
||
- name: Restart network | ||
service: | ||
name: network | ||
state: restarted | ||
when: _update_dhclient is changed | ||
|
||
- name: Disable coredns service | ||
service: | ||
name: coredns | ||
state: stopped | ||
enabled: no | ||
|
||
- name: Remove coredns config | ||
file: | ||
path: /etc/coredns/Corefile | ||
state: absent | ||
|
||
- name: Remove coredns service file | ||
file: | ||
path: /etc/systemd/system/coredns.service | ||
state: absent | ||
|
||
- name: Uninstall coredns | ||
yum: | ||
name: coredns | ||
state: absent |
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,46 @@ | ||
- name: Install coredns | ||
yum: | ||
name: coredns | ||
state: latest | ||
|
||
- name: Install service file | ||
copy: | ||
dest: /etc/systemd/system/coredns.service | ||
src: coredns.service | ||
|
||
- name: Create coredns config directory | ||
file: | ||
name: /etc/coredns | ||
state: directory | ||
|
||
- name: Configure coredns | ||
template: | ||
dest: /etc/coredns/Corefile | ||
src: Corefile.j2 | ||
register: _corefile | ||
|
||
- name: Restart coredns service | ||
service: | ||
name: coredns | ||
state: restarted | ||
enabled: yes | ||
when: _corefile is changed | ||
|
||
- name: Enable coredns service | ||
service: | ||
name: coredns | ||
state: started | ||
enabled: yes | ||
when: _corefile is not changed | ||
|
||
- name: Update dhclient config | ||
template: | ||
dest: /etc/dhcp/dhclient.conf | ||
src: dhclient.conf.j2 | ||
register: _update_dhclient | ||
|
||
- name: Restart network | ||
service: | ||
name: network | ||
state: restarted | ||
when: _update_dhclient is changed |
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,6 @@ | ||
- name: Enable coredns | ||
include_tasks: enable.yml | ||
when: coredns_dynamic_enabled | ||
- name: Disable coredns | ||
include_tasks: disable.yml | ||
when: not coredns_dynamic_enabled |
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,10 @@ | ||
{% if coredns_dynamic_enabled %} | ||
{{ coredns_dynamic_domain }}:53 { | ||
bind 127.0.0.53 | ||
dynamic { | ||
addr :{{ coredns_dynamic_http_port }} | ||
secret {{ coredns_dynamic_secret }} | ||
host_timeout {{ coredns_dynamic_timeout }} | ||
} | ||
} | ||
{% endif %} |
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 @@ | ||
{% if coredns_dynamic_enabled %} | ||
prepend domain-name-servers 127.0.0.53; | ||
{% endif %} | ||
timeout 300; | ||
retry 60; |
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,2 @@ | ||
# Set node name to register | ||
# dynamic_node_backend_name: |
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,6 @@ | ||
[Unit] | ||
Description=Register node as dynamic backend named %i | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/mageopscli register_dynamic_bakcend %i |
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,10 @@ | ||
[Unit] | ||
Description=Timer to keep dynamic backend named %i registered | ||
|
||
[Timer] | ||
OnUnitActiveSec=1min | ||
AccuracySec=30sec | ||
OnActiveSec=10sec | ||
|
||
[Install] | ||
WantedBy=timers.target |
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,2 @@ | ||
dependencies: | ||
- cs.mageops-cli |
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,15 @@ | ||
- name: Install dynamic node service | ||
copy: | ||
dest: "/etc/systemd/system/[email protected]" | ||
src: "[email protected]" | ||
|
||
- name: Install dynamic node timer | ||
copy: | ||
dest: "/etc/systemd/system/[email protected]" | ||
src: "[email protected]" | ||
|
||
- name: Enable dynamic node timer | ||
service: | ||
name: "dynamic_node@{{ dynamic_node_backend_name }}.timer" | ||
state: started | ||
enabled: yes |
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 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
dynamicnode::register_node() { | ||
local node_name=$1 | ||
curl -Lsf -H "secret: ${config__dynamicnode_secret}" -H "backend: ${node_name}" "${config__dynamicnode_endpoint_addr}/register" | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
allow_duplicates: no | ||
dependencies: | ||
- cs.repo-mageops | ||
- cs.ansible-plugins | ||
- cs.repo-varnish | ||
|
||
|
Oops, something went wrong.