displague / vagrant-linode

A Vagrant plugin that adds a Linode provider to Vagrant, allowing Vagrant to control and provision Linodes.
MIT License
124 stars 23 forks source link

Authentication failed #92

Closed mirzazeyrek closed 5 years ago

mirzazeyrek commented 5 years ago

Is this package still up-to-date ? I'm having this errors:

INFO connect_linode: Connecting to Linode api_url...
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::AfterTriggerAction:0x0000000004da1480>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::BeforeTriggerAction:0x0000000004da1318>
 INFO warden: Calling IN action: #<VagrantPlugins::Linode::Actions::Create:0x0000000004da1278>
 INFO interface: error: [{"ERRORMESSAGE"=>"Authentication failed", "ERRORCODE"=>4}]
 INFO interface: error: ==> default: [{"ERRORMESSAGE"=>"Authentication failed", "ERRORCODE"=>4}]
==> default: [{"ERRORMESSAGE"=>"Authentication failed", "ERRORCODE"=>4}]
ERROR warden: Error occurred: API Error encountered
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.

I've created a token with full access:

image

here is my Vagrantfile:

Vagrant.configure('2') do |config|
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.provider :linode do |provider, override|
    override.ssh.private_key_path = '~/.ssh/id_rsa'
    override.vm.box = 'linode/ubuntu1804'

    provider.token = "mytoken"
    provider.distribution = 'Ubuntu 18.04 LTS'
    provider.datacenter = 'newark'
    #provider.plan = 'Linode 2GB'

    provider.planid = 2
    # provider.paymentterm = <*1*,12,24>
    # provider.datacenterid = <int>
    # provider.image = <string>
    # provider.imageid = <int>
    # provider.kernel = <string>
    # provider.kernelid = <int>
    # provider.private_networking = <boolean>
    # provider.stackscript = <string> # Not Supported Yet
    # provider.stackscriptid = <int> # Not Supported Yet
    # provider.distributionid = <int>
  end
end
mirzazeyrek commented 5 years ago

Ok, turns out api key should be created from old interface.

https://manager.linode.com/profile/index

displague commented 5 years ago

@mirzazeyrek that is correct. As the cloud.linode.com becomes standard for new users this distinction will require more clarity in the documentation.


I realize this is a bit like selling oranges to someone who asked for apples, but the following would be the equivalent in Terraform:

provider "linode" {}

resource "linode_instance" "dev" {
  image = "linode/ubuntu-18.04"
  region = "us-east"
  type = "g6-standard-1"
  authorized_keys = [ "${chomp(file("~/.ssh/id_rsa.pub"))}" ]

  provisioner "file" {
    source = "./"
    destination = "/vagrant"
  }

  provisioner "remote-exec" {
    // ... do something
    // https://www.terraform.io/docs/provisioners/
  }
}

And to execute that:

terraform init
 export LINODE_TOKEN=my_cloud_token
terraform apply
terraform show

For more information: https://www.terraform.io/docs/providers/linode/index.html

I created both the Terraform resource and the Vagrant plugin. This vagrant interface is overdue for an APIv4 rewrite.

That said, it is still usable if you do prefer (or the project demands) Vagrant.