Auth Failure II
Closed this issue · 6 comments
This is a continuation of #200
It was closed without any apparent solution. None that I could read anyway. Maybe I missed something?
First off where I am version wise
Vagrant 1.7.4
vagrant-digitalocean (0.7.8)
Also I used the plugin before to push a version of my project. When I am in that branch, I can vagrant ssh into the previous version of the box.
It's when I try to up a new version things see to turn sour.
my Vagrantfile content
def digitalocean(config, fqdn, domain)
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = '~/.ssh/mykey_rsa'
override.vm.box = 'digital_ocean'
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
provider.token = 'myTestedHardcodedToken'
provider.ssh_key_name = 'Vagrant'
provider.image = 'ubuntu-14-04-x64'
provider.region = 'nyc2'
provider.size = '512mb'
ansible(override, fqdn, domain, 'digitalocean')
end
end
I tested
vagrant digitalocean-list images YOUR_TOKEN_HERE
which returns a pretty list of things
calling the API directly like so
curl -X GET "https://api.digitalocean.com/v2/droplets" -H "Authorization: Bearer $TOKEN"
returns me my available droplets
But running :
vagrant up --provider=digital_ocean
Returns
There was an issue with the request made to the DigitalOcean
API at:
Path: /v2/droplets
URI Params: {}
The response status from the API was:
Status: 401
Response: {"id"=>"unauthorized", "message"=>"Unable to authenticate you."}
Just in case, here's the full Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
VAGRANT_DEFAULT_PROVIDER = 'lxc'
def ansible(config, fqdn, domain, provider)
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.host_key_checking = false
ansible.extra_vars = {
"sq_environment" => ENV['ENVIRONMENT'],
"fqdn" => fqdn,
"domain" => domain,
"vagrant_provider" => provider
}
ansible.limit = 'all'
# ansible.verbose = 'vvv'
end
end
def lxc(config, fqdn, domain)
config.vm.provider :lxc do |lxc, override|
override.vm.box = 'fgrehm/trusty64-lxc'
override.vm.synced_folder ".", "/vagrant"
ansible(override, fqdn, domain, 'lxc')
end
end
def digitalocean(config, fqdn, domain)
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = '~/.ssh/deploy_rsa'
override.vm.box = 'digital_ocean'
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
provider.ssh_key_name = 'Vagrant'
provider.token = 'myTestedHardcodedToken'
provider.image = 'Ubuntu 14.04 x64'
provider.region = 'nyc2'
provider.size = '512mb'
ansible(override, fqdn, domain, 'digitalocean')
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# ensure we have the needed environment variables.
if ENV['ENVIRONMENT'].nil?
ENV['ENVIRONMENT'] = 'sandbox'
end
if ENV['ENVIRONMENT'] == 'prod'
domain = "domain.net"
else
domain = "#{ENV['ENVIRONMENT']}.domain.net"
end
fqdn = "#{domain}"
config.vm.define "web", primary: true do |machine|
lxc(machine, "www.#{domain}", domain)
end
end
adding
digitalocean(machine, "www.#{domain}", domain)
to
config.vm.define "web", primary: true do |machine|
seems to have done the trick. Will report back if I can find out what exactly happened there.
Also noteworthy;
provider.image = 'Ubuntu 14.04 x64'
has to be
provider.image = '13089493'
sorry for the spam.
No worries. Your Vagrantfile goes a bit out of the normal use case, so you will need to massage accordingly, which it seems like you have. Check out Catapult for a website management platform that we're launching.
Thanks! Thought I'd make sure I send the answer. Using vagrant-digitalocean for personal stuff. We've been working on jeto (https://github.com/StudioQi/jeto) For a while on our end. Feel free to swing by to see if there's anything you guys find useful.
@vevmesteren Its been a while since your last post on this issue. Did you happen to find a solution to the authentication failure? I'm using the versions listed below, have the access token in the Vagrant file and login still fails.
Vagrant 1.8.1
vagrant-digitalocean (0.7.10)
There was an issue with the request made to the DigitalOcean
API at:
Path: /v2/droplets
URI Params: {}
The response status from the API was:
Status: 401
Response: {"id"=>"unauthorized", "message"=>"Unable to authenticate you."}
Cheers,
I did post my "fix" right here.