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

Vagrant up doesn't start provisions #52

Closed skcc321 closed 8 years ago

skcc321 commented 8 years ago

Hi everyone! Some time ago (approximately half a year) everything was working pretty well. But now I have a strange problem.

'Vagrant up' stops at creating user state and doesn't start provisions automatically.

here is Vagrant file:

VAGRANTFILE_API_VERSION = "2"
INSTANCE_COUNT = 20

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.omnibus.chef_version = 'latest'

  config.ssh.username = 'deployer'
  config.ssh.private_key_path = '~/.ssh/id_rsa'

  INSTANCE_COUNT.times do |i|
    config.vm.define "do-#{i}" do |web_config|
      web_config.vm.provider :digital_ocean do |provider, override|
        override.vm.box = 'digital_ocean'
        override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"

        provider.token = [PROVIDER_TOKEN]
        provider.image = 'ubuntu-14-04-x64'
        provider.backups_enabled = true
        provider.region = 'nyc3'
        provider.size = '8Gb'
      end
    end

    config.vm.define "li-#{i}" do |web_config|
      web_config.vm.provider :linode do |provider, override|
        override.vm.box = 'linode'
        override.vm.box_url = "https://github.com/displague/vagrant-linode/raw/master/box/linode.box"

        provider.token = [PROVIDER_TOKEN]
        provider.distribution = 'Ubuntu 14.04 LTS'
        provider.datacenter = 'atlanta'
        provider.plan = '8192'
      end
    end
  end

  config.vm.provision "chef_solo" do |chef|
    chef.cookbooks_path = "cookbooks/"
    File.open(File.join(File.expand_path(File.dirname(__FILE__)), 'nodes', 'main.json')) do |f|
      chef.json = JSON.parse(f.read)
    end
  end
end

$ vagrant up li-1

gives next log:

==> li-8: Linode has not been created ==> li-8: Creating a new linode... ==> li-8: Created a new linode... 1460278 ==> li-8: Booting Linode 1460278 ... ==> li-8: Assigned IP address: [IP_ADDRESS] ==> li-8: Machine State ID: brand_new ==> li-8: IP Address: [IP_ADDRESS] ==> li-8: Machine State ID: active ==> li-8: IP Address: [IP_ADDRESS] ==> li-8: Creating user account: deployer...

end at current state it just exits with no error The only chance to continue is execute manually provisions after vagrant up command.

Why it happens?

displague commented 8 years ago

This started after a refactor a few months ago -- it went unnoticed or unreported until recently. I think @ssplatt had a fix. You can vagrant provision manually as a workaround.

I won't be able to address this for a few more days, I believe the 0.1.3 gem works as expected but beware some config variables have been renamed since then (the old names are still supported in 0.2.*).

displague commented 8 years ago

Please try v0.2.2

skcc321 commented 8 years ago

Yep, in v0.2.2 that bug is fixed, but now I got missing rsyncing error.

log:

Linode has not been created ==> li-11: Creating a new linode... ==> li-11: Created a new linode... 1477133 ==> li-11: Booting Linode 1477133 ... ==> li-11: Assigned IP address: [hidden] ==> li-11: Machine State ID: brand_new ==> li-11: IP Address: [hidden] ==> li-11: Machine State ID: active ==> li-11: IP Address: [hidden] ==> li-11: Machine State ID: active ==> li-11: IP Address: [hidden] ==> li-11: Creating user account: [hidden]... ==> li-11: Installing Chef 12.5.1 Omnibus package... ==> li-11: Downloading Chef 12.5.1 for ubuntu... ==> li-11: downloading https://www.chef.io/chef/metadata?v=12.5.1&prerelease=false nightlies=false&p=ubuntu&pv=14.04&m=x86_64 ==> li-11: to file /tmp/install.sh.3373/metadata.txt ==> li-11: trying wget... ==> li-11: url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/14.04/x86_64/chef_12.5.1-1_amd64.deb ==> li-11: md5 [hidden] ==> li-11: sha256 [hidden] ==> li-11: downloaded metadata file looks valid... ==> li-11: downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/14.04/x86_64/chef_12.5.1-1_amd64.deb ==> li-11: to file /tmp/install.sh.3373/chef_12.5.1-1_amd64.deb ==> li-11: trying wget... ==> li-11: Comparing checksum with sha256sum... ==> li-11: Installing Chef 12.5.1 ==> li-11: installing with dpkg... ==> li-11: Selecting previously unselected package chef. ==> li-11: (Reading database ... 23405 files and directories currently installed.) ==> li-11: Preparing to unpack .../chef_12.5.1-1_amd64.deb ... ==> li-11: Unpacking chef (12.5.1-1) ... ==> li-11: Setting up chef (12.5.1-1) ... ==> li-11: Thank you for installing Chef! ==> li-11: Running provisioner: chef_solo... ==> li-11: Detected Chef (latest) is already installed ==> li-11: Machine State ID: active ==> li-11: IP Address: 45.79.202.151 ==> li-11: Machine State ID: active ==> li-11: IP Address: 45.79.202.151 ==> li-11: Machine State ID: active ==> li-11: IP Address: 45.79.202.151

Shared folders that Chef requires are missing on the virtual machine. This is usually due to configuration changing after already booting the machine. The fix is to run a vagrant reload so that the proper shared folders will be prepared and mounted on the VM.

ssplatt commented 8 years ago

ran into the same issue. provisioner: salt started but the folders never rsynced, so i got

.... cut ....
[DEBUG   ] Could not find file from saltenv 'base', u'salt://top.sls'

[DEBUG   ] No contents loaded for env: base

[DEBUG   ] compile template: False

[ERROR   ] Template was specified incorrectly: False

[ERROR   ] No contents found in top file

[DEBUG   ] LazyLoaded config.option

[DEBUG   ] LazyLoaded highstate.output

local:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or external nodes data matches found.
     Started:
    Duration:
     Changes:

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms
displague commented 8 years ago

Ok - let's try v0.2.3.

skcc321 commented 8 years ago

Great! It works well again! Thank you for quick response ;)

ssplatt commented 8 years ago

confirmed here too. works for me.

displague commented 8 years ago

awesome!