Skip to content

Instantly share code, notes, and snippets.

@stvnwrgs
Created October 12, 2015 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stvnwrgs/cf346143cf57ee76cb27 to your computer and use it in GitHub Desktop.
Save stvnwrgs/cf346143cf57ee76cb27 to your computer and use it in GitHub Desktop.
Bash one-liner for generating a etcd2 discovery token and replace it in a yml file
step1: res=$(curl -w "\n" 'https://discovery.etcd.io/new?size=3') => set var res = discovery url
step2: sed -i'' -e "s,discovery: \".*,discovery: \"$res\",g" coreos/etcd.yml; => replace
step3: rm coreos/etcd.yml-e; => remove to stupid backup file
res=$(curl -w "\n" 'https://discovery.etcd.io/new?size=3');sed -i'' -e "s,discovery: \".*,discovery: \"$res\",g" coreos/etcd.yml;rm coreos/etcd.yml-e;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment