Search code examples
vagrantvirtualboxconsul

wget is failing to get consul download from vagrant


I am trying to create a consul cluster using vagrant and virtual box. While trying to download consul, wget is unable to establish SSL connection. Below are the logs from vagrant. wget is working fine for other downloads and I verified that the consul download link is working too. Curl works fine on this link too. But, weirdly if I use CURl in vagrant provision, it simply is not downloading (no logs) at all. Can some one help me with this weird wget issue? I tried upgrading 'wget' too.

==> consulredis1: --2017-01-11 02:17:04--  https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip
==> consulredis1: Resolving releases.hashicorp.com (releases.hashicorp.com)...
==> consulredis1: 151.101.65.183
==> consulredis1: ,
==> consulredis1: 151.101.129.183
==> consulredis1: ,
==> consulredis1: 151.101.193.183
==> consulredis1: , ...
==> consulredis1: Connecting to releases.hashicorp.com         (releases.hashicorp.com)|151.101.65.183|:443...
==> consulredis1: connected.
==> consulredis1: Unable to establish SSL connection.

Here is my provisioning script

#!/bin/bash

# Step 1 - Get the necessary utilities and install them.
sudo apt-get update
sudo apt-get install -y unzip curl wget
sudo apt-get install -y make gcc build-essential
#apt-get install 

# Step 2 - Copy the init script to the /etc/init folder.
cp /vagrant/consul.conf /etc/init/consul.conf

# Step 3 - Get the Consul Zip file and extract it.  
cd /usr/local/bin
wget http://download.redis.io/redis-stable.tar.gz
curl -k http://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip
unzip *.zip
rm *.zip

# Step 4 - Make the Consul directory.
sudo mkdir -p /etc/consul.d
sudo chmod a+w /etc/consul.d
sudo mkdir /var/consul

# Step 5 - Copy the server configuration.
cp $1 /etc/consul.d/config.json

# Step 6 - Start Consul
exec consul agent -config-file=/etc/consul.d/config.json

My Vagrantfile contents

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "hashicorp/precise64"

  config.vm.define "consulredis1" do |consulredis1|
    config.vm.provision "shell" do |s|
        s.path = "provision.sh"
        s.args   = ["/vagrant/node1/config.json","/vagrant/node1/redis-cluster-1.init.conf","/vagrant/node1/redis-cluster-1.conf"]
    end
    consulredis1.vm.hostname = "consulredis1"
    consulredis1.vm.network "private_network", ip: "172.20.20.10"
  end
end

Solution

  • There seems to be issue with the distribution from "hashicorp/precise64". I simply switched to using "ubuntu/trusty64" and wget worked fine.

    #config.vm.box = "hashicorp/precise64"
    config.vm.box = "ubuntu/trusty64"