Created
February 29, 2016 03:50
-
-
Save mischief/f972a90a9b374b856648 to your computer and use it in GitHub Desktop.
coreos templates via makefile
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
| CTX=etcd.yaml.tmpl.ctx | |
| etcd: CONFS=$(addsuffix .json, $(shell cat .hosts)) | |
| etcd: $(CTX) $(ROOT)/bin/templater .hosts | |
| make $(CONFS) | |
| install: CONFS=$(addsuffix .json, $(shell cat .hosts)) | |
| install: etcd .hosts | |
| scp $(CONFS) $(CONFIG_TARGET)/ignition/ | |
| health: HOSTS=$(shell cat .hosts) | |
| health: .hosts | |
| H=$$(echo $(HOSTS) | cut -d ' ' -f $$(expr $$RANDOM % $$(echo $(HOSTS) | wc -w) + 1)); \ | |
| echo host: "$$H"; \ | |
| ssh "$$H" etcdctl cluster-health | |
| reboot: HOSTS=$(shell cat .hosts) | |
| reboot: .hosts | |
| for host in $(HOSTS); do \ | |
| ssh $$host sudo reboot; \ | |
| while ! ssh -o ConnectTimeout=10 $$host etcdctl cluster-health; do sleep 1; done \ | |
| done | |
| %.yaml: etcd.yaml.tmpl $(CTX) $(ROOT)/bin/templater | |
| HOST=$* $(ROOT)/bin/templater -c $(CTX) < $< > $@ | |
| .hosts: $(CTX) $(ROOT)/bin/templater | |
| echo '{{range $$k, $$v := .hosts}}{{$$k}} {{end}}{{range $$k, $$v := .proxies}}{{$$k}} {{end}}' | $(ROOT)/bin/templater -c $(CTX) > $@ | |
| .PHONY: etcd install | |
| include $(ROOT)/Makefile.inc | |
| include $(ROOT)/Makefile.private |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment