diff --git a/.gitignore b/.gitignore index 759d7e8..e063d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ real-adminrc *.taskpaper terraform/tf-example/terraform.tfstate* +consul-*.config.json diff --git a/docker/swarm-consul/consul.sh b/docker/swarm-consul/consul.sh index 132e9da..593b879 100644 --- a/docker/swarm-consul/consul.sh +++ b/docker/swarm-consul/consul.sh @@ -1,4 +1,5 @@ #!/bin/bash +PLATFORM='linux_amd64' # Update list of packages export DEBIAN_FRONTEND=noninteractive @@ -17,11 +18,13 @@ fi if [[ ! -e /usr/local/bin/consul ]];then # Download Consul - curl -kLO https://releases.hashicorp.com/consul/0.7.0/consul_0.7.0_linux_amd64.zip + IFS=' ' CURL_OUT=$(curl https://releases.hashicorp.com/consul/) + CONSUL_VERSION=$(echo ${CURL_OUT} | grep href | grep consul | head -n 1 | awk -F'/' '{print $3}') + curl -kL https://releases.hashicorp.com/consul/$CONSUL_VERSION/consul_${CONSUL_VERSION}_${PLATFORM}.zip > consul.zip # Decompress and remove Consul download - unzip consul_0.7.0_linux_amd64.zip - rm consul_0.7.0_linux_amd64.zip + unzip consul.zip + rm consul.zip # Move Consul binary to location in path sudo mv consul /usr/local/bin/ diff --git a/docker/swarm-ha/consul.sh b/docker/swarm-ha/consul.sh index 132e9da..593b879 100644 --- a/docker/swarm-ha/consul.sh +++ b/docker/swarm-ha/consul.sh @@ -1,4 +1,5 @@ #!/bin/bash +PLATFORM='linux_amd64' # Update list of packages export DEBIAN_FRONTEND=noninteractive @@ -17,11 +18,13 @@ fi if [[ ! -e /usr/local/bin/consul ]];then # Download Consul - curl -kLO https://releases.hashicorp.com/consul/0.7.0/consul_0.7.0_linux_amd64.zip + IFS=' ' CURL_OUT=$(curl https://releases.hashicorp.com/consul/) + CONSUL_VERSION=$(echo ${CURL_OUT} | grep href | grep consul | head -n 1 | awk -F'/' '{print $3}') + curl -kL https://releases.hashicorp.com/consul/$CONSUL_VERSION/consul_${CONSUL_VERSION}_${PLATFORM}.zip > consul.zip # Decompress and remove Consul download - unzip consul_0.7.0_linux_amd64.zip - rm consul_0.7.0_linux_amd64.zip + unzip consul.zip + rm consul.zip # Move Consul binary to location in path sudo mv consul /usr/local/bin/