def database_configuration
path = paths["config/database"].existent.first
yaml = Pathname.new(path) if path
- /etc/hosts.ctmpl
{{range services}}
{{range service .Name}}
{{.Address}} {{.Name}}{{end}}{{end}}
- /etc/hosts
-
command
./consul-template_0.6.0_linux_amd64/consul-template -consul 127.0.0.1:8500 -template "/etc/hosts.ctmpl:/etc/hosts:service dnsmasq restart &"
-
/etc/hosts.ctmpl
# node{{ range nodes }}
{{.Address}} {{.Node}}{{ end }}
# service{{range $tag, $services := service "echo" | byTag}}
{{range $services}}{{.Address}} {{$tag}}.{{.Name}}{{end}}{{end}}
This file contains hidden or 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
#!/usr/bin/env ruby | |
require "poppler" | |
require 'pp' | |
file = ARGV[0] | |
document = Poppler::Document.new(file) | |
document.each do |d| | |
puts d.get_text |
['-']% curl -X PUT -d 'bar' http://127.0.0.1:8500/v1/kv/foo
true
['-']%
['-']%
['-']% curl -s http://127.0.0.1:8500/v1/kv/foo | jq .
[
{
"CreateIndex": 538,
"ModifyIndex": 538,
This file contains hidden or 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
aws autoscaling describe-launch-configurations \ | |
| jq '.LaunchConfigurations[] \ | |
| select(.LaunchConfigurationName \ | |
| contains("*LAUNCH_CONFIG_NAME*")) \ | |
| .LaunchConfigurationName ' \ | |
-r \ |
This file contains hidden or 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
$ aws ec2 describe-images \ | |
--filters "Name=name,Values='*AMI_NAME*'" \ | |
--query 'Images[].[Name,ImageId]' \ | |
--output text` |
This file contains hidden or 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
package main | |
import ( | |
"encoding/json" | |
"github.com/mizzy/consul-catalog" | |
"log" | |
"os" | |
"reflect" | |
"time" | |
) |