Created
January 19, 2015 10:58
-
-
Save michaeltchapman/33324401461e249d4f5c to your computer and use it in GitHub Desktop.
consul-template is really hard to use :(
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
global | |
chroot /var/lib/haproxy | |
daemon | |
group haproxy | |
maxconn 4000 | |
pidfile /var/run/haproxy.pid | |
stats socket /var/lib/haproxy/stats | |
user haproxy | |
defaults | |
log global | |
maxconn 8000 | |
option redispatch | |
retries 3 | |
stats enable | |
timeout http-request 10s | |
timeout queue 1m | |
timeout connect 10s | |
timeout client 1m | |
timeout server 1m | |
timeout check 10s | |
listen consul | |
bind 192.168.242.41:8300 | |
listen glance-api | |
bind 192.168.242.41:9292 | |
listen glance-registry | |
bind 192.168.242.41:9191 | |
listen keystone | |
bind 192.168.242.41:5000 | |
server 192.168.242.12:5000 check inter 10s | |
listen mysql | |
bind 192.168.242.41:3306 | |
balance roundrobin | |
mode tcp | |
option tcpka | |
option tcplog | |
timeout connect 10000 | |
server 192.168.242.12:3306 check inter 10s | |
listen neutron-server | |
bind 192.168.242.41:9696 | |
listen nova-api | |
bind 192.168.242.41:8774 | |
listen nova-api-ec2 | |
bind 192.168.242.41:8773 | |
listen nova-api-metadata | |
bind 192.168.242.41:8775 | |
listen rabbitmq | |
bind 192.168.242.41:5672 |
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
{{ $facter := file "/tmp/facter.json" | parseJSON }} | |
{{ $meta_data := file "/tmp/meta_data.json" | replaceAll "\"%{" "\"" | replaceAll "}\"" "\"" | parseJSON }} | |
global | |
chroot /var/lib/haproxy | |
daemon | |
group haproxy | |
maxconn 4000 | |
pidfile /var/run/haproxy.pid | |
stats socket /var/lib/haproxy/stats | |
user haproxy | |
defaults | |
log global | |
maxconn 8000 | |
option redispatch | |
retries 3 | |
stats enable | |
timeout http-request 10s | |
timeout queue 1m | |
timeout connect 10s | |
timeout client 1m | |
timeout server 1m | |
timeout check 10s | |
{{range services }}listen {{.Name}} | |
{{ $service := service .Name }}{{ if $service }} | |
bind {{ index $facter (index $meta_data "meta" "internal_address") }}:{{ (index $service 0).Port }} | |
{{ range .Tags }}{{ $tag := parseJSON . }}{{ range $key, $value := $tag }}{{ if not ( eq $key "server" ) }} | |
{{$key}} {{$value}}{{ end }}{{ end }}{{end}} | |
{{range $_service := service .Name}}{{ range .Tags }}{{ $tag := parseJSON . }}{{ range $key, $value := $tag }}{{ if eq $key "server" }} server {{$_service.Address}}:{{$_service.Port}} {{$value}} | |
{{end}}{{end}}{{end}}{{end}}{{end}}{{end}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment