Giter Club home page Giter Club logo

vagrant-rackspace's Introduction

Vagrant Rackspace Cloud Provider

This is a Vagrant 1.5+ plugin that adds a Rackspace Cloud provider to Vagrant, allowing Vagrant to control and provision machines within Rackspace cloud.

Note: This plugin requires Vagrant 1.5+. Windows support requires Vagrant 1.6+.

Features

  • Boot Rackspace Cloud instances.
  • SSH into the instances.
  • Provision the instances with any built-in Vagrant provisioner.
  • Sync folders with any built-in Vagrant synchronized folder plugin (e.g. rsync)
  • Create Rackspace images from a running Vagrant box

Installation

Install using standard Vagrant plugin installation methods.

$ vagrant plugin install vagrant-rackspace

Usage

Once the plugin is installed, you use it with vagrant up by specifing the rackspace provider:

$ vagrant up --provider=rackspace

You'll need a Vagrantfile in order to test it out. You can generate a sample Vagrantfile with vagrant init. Here's an example with Rackspace configuration:

Vagrant.configure("2") do |config|
  # The box is optional in newer versions of Vagrant
  # config.vm.box = "dummy"

  config.vm.provider :rackspace do |rs|
    rs.username         = "your-rackspace-user-name"
    rs.api_key          = "your-rackspace-api-key"
    rs.rackspace_region = :ord
    rs.flavor           = /1 GB Performance/
    rs.image            = /Ubuntu/
    rs.metadata         = {"key" => "value"}       # optional
  end
end

Set up environment variables on your shell, for frequently used parameters, especially your username and api key, if you plan to share your vagrant files. this will prevent accidentally divulging your keys.

    .tcshrc:
        setenv RAX_USERNAME "your-rackspace-user-name"
        setenv RAX_REG ":region"
        setenv API_KEY "your-rackspace-api-key"
    .bashrc or .zshrc
        export RAX_USERNAME="your-rackspace-user-name"
        export RAX_REG=":region"
        export API_KEY="your-rackspace-api-key"

Change your vagrant file to source your environment. It should look like this:

Vagrant.configure("2") do |config|
  # The box is optional in newer versions of Vagrant
  # config.vm.box = "dummy"

  config.vm.provider :rackspace do |rs|
    rs.username         = ENV['RAX_USERNAME']
    rs.api_key          = ENV['RAX_API_KEY']
    rs.rackspace_region = ENV['RAX_REG']
    rs.flavor           = /1 GB Performance/
    rs.image            = /Ubuntu/
    rs.metadata         = {"key" => "value"}       # optional
  end
end

You may be required to use a box, depending on your version of Vagrant. If necessary you can add the "dummy" box with the command:

$ vagrant box add dummy https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box

Then uncomment the line containing config.vm.box = "dummy".

RackConnect

If you are using RackConnect with vagrant, you will need to add the following line to the config.vm.provider section to prevent timeouts.

rs.rackconnect = true

CentOS / RHEL / Fedora

The default configuration of the RHEL family of Linux distributions requires a tty in order to run sudo. Vagrant does not connect with a tty by default, so you may experience the error:

sudo: sorry, you must have a tty to run sudo

You can tell Vagrant it should use a pseudo-terminal (pty) to get around this issue with the option:

  config.ssh.pty = true

However, Vagrant does not always work well with the pty. In particular, rsync may not work. So we recommend using this configuration for a workaround which will reconfigure the server so a tty is not required to run sudo:

The following settings show an example of how you can workaround the issue:

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"
  config.ssh.pty = true

  config.vm.provider :rackspace do |rs|
    rs.username = ENV['RAX_USERNAME']
    rs.api_key  = ENV['RAX_API_KEY']
    rs.flavor   = /1 GB Performance/
    rs.image    = /^CentOS/
    rs.init_script = 'sed -i\'.bk\' -e \'s/^\(Defaults\s\+requiretty\)/# \1/\' /etc/sudoers'
  end
end

Windows (enabling WinRM)

Vagrant 1.6 and later support WinRM as an alternative to SSH for communicating with Windows machines, though secure WinRM connections at this time. They are expected to be added in a 1.7.x release of Vagrant.

Be aware of the security limitations:

  • Vagrant's WinRM support is not as secure as SSH. You should only use it for testing purposes where these warnings are acceptible. If you require a more secure setup you'll need to either configure SSH on Windows, or to wait until for future Vagrant releases with better WinRM security.
    • The current Vagrant release (v1.7.0) only supports WinRM as plaintext over HTTP, but SSL support is in progress and should hopefully be released in the near future.
    • The default setup, even with SSL support, uses self-signed certificates. If you want to use a real Certificate Authority you'll need to customize your Windows images or `init_script

If you still choose to use Vagrant and WinRM for development and testing, then you'll need a Windows image with WinRM enabled. WinRM is not enabled by default for the Rackspace images, but you can use the init_script configuration option to enable and secure it so Vagrant will be able to connect. This example enables WinRM for both HTTP and HTTPS traffic:

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"

  config.vm.provider :rackspace do |rs|
    rs.username = ENV['RAX_USERNAME']
    rs.api_key  = ENV['RAX_API_KEY']
    rs.flavor   = /1 GB Performance/
    rs.image    = 'Windows Server 2012'
    rs.init_script = File.read 'bootstrap.cmd'
  end
end

You can get a sample bootstrap.cmd file from this repo.

Parallel, multi-machine setup

You can define multiple machines in a single Vagrant file, sourcing common parameters from your shell environment, for example:

Environment

    .tcshrc:
        setenv RAX_USERNAME "your-rackspace-user-name"
        setenv RAX_REG ":region"
        setenv API_KEY "your-rackspace-api-key"
        setenv VAGRANT_ADMIN_PASSWORD "your-vagrant-admin-password"
    .bashrc or .zshrc
        export RAX_USERNAME="your-rackspace-user-name"
        export RAX_REG=":region"
        export API_KEY="your-rackspace-api-key"
        export VAGRANT_ADMIN_PASSWORD="your-vagrant-admin-password"

Vagrantfile:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # All Vagrant configuration is done here. The most common configuration
  # options are documented and commented below. For a complete reference,
  # please see the online documentation at vagrantup.com.

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "dummy"

  config.vm.define :ubuntu do |ubuntu|
    ubuntu.ssh.private_key_path = '~/.ssh/id_rsa'
    ubuntu.vm.provider :rackspace do |rs|
      rs.username = ENV['RAX_USERNAME']
      rs.admin_password = ENV['VAGRANT_ADMIN_PASSWORD']
      rs.api_key  = ENV['RAX_API_KEY']
      rs.flavor   = /1 GB Performance/
      rs.image    = /Ubuntu/
      rs.rackspace_region = :iad
      rs.public_key_path = '~/.ssh/id_rsa.pub'
    end
  end

  config.vm.define :centos do |centos|
    centos.ssh.private_key_path = '~/.ssh/id_rsa'
    centos.ssh.pty = true
    centos.vm.provider :rackspace do |rs|
      rs.username = ENV['RAX_USERNAME']
      rs.admin_password = ENV['VAGRANT_ADMIN_PASSWORD']
      rs.api_key  = ENV['RAX_API_KEY']
      rs.flavor   = /1 GB Performance/
      rs.image    = /^CentOS/ # Don't match OnMetal - CentOS
      rs.rackspace_region = :iad
      rs.public_key_path = '~/.ssh/id_rsa.pub'
      rs.init_script = 'sed -i\'.bk\' -e \'s/^\(Defaults\s\+requiretty\)/# \1/\' /etc/sudoers'
    end
  end

  config.vm.define :windows do |windows|
    windows.vm.provision :shell, :inline => 'Write-Output "WinRM is working!"'
    windows.vm.communicator = :winrm
    windows.winrm.username = 'Administrator'
    windows.winrm.password = ENV['VAGRANT_ADMIN_PASSWORD']
    begin
      windows.winrm.transport = :ssl
      windows.winrm.ssl_peer_verification = false
    rescue
      puts "Warning: Vagrant #{Vagrant::VERSION} does not support WinRM over SSL."
    end
    windows.vm.synced_folder ".", "/vagrant", disabled: true
    windows.vm.provider :rackspace do |rs|
      rs.username = ENV['RAX_USERNAME']
      rs.api_key  = ENV['RAX_API_KEY']
      rs.admin_password = ENV['VAGRANT_ADMIN_PASSWORD']
      rs.flavor   = /2 GB Performance/
      rs.image    = 'Windows Server 2012'
      rs.rackspace_region = ENV['RAX_REG'] ||= 'dfw'
      rs.init_script = File.read 'bootstrap.cmd'
    end
  end
end

You than can then launch them all with vagrant up --provider rackspace, or a specific server with vagrant up --provider rackspace <name>.

Vagrant will create all machines simultaneously when you have multi-machine setup. If you want to create them one at a time or have any trouble, you can use the --no-parallel option.

Custom Commands

The plugin includes several Rackspace-specific vagrant commands. You can get the list of available commands with vagrant rackspace -h.

Flavors / Images

You can list all available images with the command:

$ vagrant rackspace images
$ vagrant rackspace flavors

If you have a multi-machine setup than this will show the images/flavors for each machine. This seems a bit repetitive, but since machines can be configured for different regions or even accounts they may have a different set of available images or flavors. You can also get the list for a specific machine by specifying it's name as an argument:

$ vagrant rackspace images <name>
$ vagrant rackspace flavors <name>

Custom Commands

The plugin includes several Rackspace-specific vagrant commands. You can get the list of available commands with vagrant rackspace -h.

For example to list all available images for a machine you can use:

$ vagrant rackspace images

In a multi-machine Vagrantfile you can also query for a single machine:

$ vagrant rackspace images <name>

These commands will connect to Rackspace using the settings associated with the machine, and query the region to get the list of available flavors, images, keypairs, networks and servers.

Configuration

This provider exposes quite a few provider-specific configuration options:

  • api_key - The API key for accessing Rackspace.
  • flavor - The server flavor to boot. This can be a string matching the exact ID or name of the server, or this can be a regular expression to partially match some server flavor. Flavors are listed here.
  • image - The server image to boot. This can be a string matching the exact ID or name of the image, or this can be a regular expression to partially match some image.
  • rackspace_region - The region to hit. By default this is :dfw. Valid options are: :dfw, :ord, :lon, :iad, :syd. Users should preference using this setting over rackspace_compute_url setting.
  • rackspace_compute_url - The compute_url to hit. This is good for custom endpoints.
  • rackspace_auth_url - The endpoint to authentication against. By default, vagrant will use the global rackspace authentication endpoint for all regions with the exception of :lon. IF :lon region is specified vagrant will authenticate against the UK authentication endpoint.
  • public_key_path - The path to a public key to initialize with the remote server. This should be the matching pair for the private key configured with config.ssh.private_key_path on Vagrant.
  • key_name - If a public key has been uploaded to the account already, the uploaded key can be used to initialize the remote server by providing its name. The uploaded public key should be the matching pair for the private key configured with config.ssh.private_key_path on Vagrant.
  • server_name - The name of the server within RackSpace Cloud. This defaults to the name of the Vagrant machine (via config.vm.define), but can be overridden with this.
  • username - The username with which to access Rackspace.
  • disk_config - Disk Configuration 'AUTO' or 'MANUAL'
  • metadata - A set of key pair values that will be passed to the instance for configuration.

These can be set like typical provider-specific configuration:

Vagrant.configure("2") do |config|
  # ... other stuff

  config.vm.provider :rackspace do |rs|
    rs.username = ENV['RAX_USERNAME']
    rs.api_key  = ENV['RAX_API_KEY']
  end
end

You can find a more complete list the documentation for the Config class.

Networks

Networking features in the form of config.vm.network are not supported with vagrant-rackspace, currently. If any of these are specified, Vagrant will emit a warning, but will otherwise boot the Rackspace server.

However, you may attach a VM to an isolated Cloud Network (or Networks) using the network configuration option. Here's an example which adds two Cloud Networks and disables ServiceNet with the :attach => false option:

config.vm.provider :rackspace do |rs|
  rs.username = ENV['RAX_USERNAME']
  rs.api_key  = ENV['RAX_API_KEY']
  rs.network '443aff42-be57-effb-ad30-c097c1e4503f'
  rs.network '5e738e11-def2-4a75-ad1e-05bbe3b49efe'
  rs.network :service_net, :attached => false
end

Synced Folders

You can use this provider with the Vagrant synced folders. The default type should be rsync for most images, with the possible exception of Windows.

Plugins

Vagrant has great support for plugins and many of them should work alongside vagrant-rackspace. See the list of Available Vagrant Plugins.

Development

To work on the vagrant-rackspace plugin, clone this repository out, and use Bundler to get the dependencies:

$ bundle

Once you have the dependencies, verify the unit tests pass with rake:

$ bundle exec rake

If those pass, you're ready to start developing the plugin. You can test the plugin without installing it into your Vagrant environment by just creating a Vagrantfile in the top level of this directory (it is gitignored) that uses it, and uses bundler to execute Vagrant:

$ bundle exec vagrant up --provider=rackspace

vagrant-rackspace's People

Contributors

avelis avatar berendt avatar cyli avatar davidwittman avatar dkinzer avatar dr-strangecode avatar emyl avatar git-harry avatar hlecuanda avatar krames avatar maxlinc avatar mbarton avatar michaelsbradleyjr avatar mitchellh avatar richtermeister avatar seanorama avatar smashwilson avatar trizko avatar viable-hartman avatar vmtrooper avatar zacharydanger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vagrant-rackspace's Issues

Support manual disk mode

Rackspace's initial provision process is slow, and using manual disk mode is the best way to spin up servers faster. Fog supports this by adding a disk_config: 'MANUAL' option to the end of a create_server() call. 1

To support this, the syntax should be:

Vagrant.configure("2") do |config|
  # ... other stuff

  config.vm.provider :rackspace do |rs|
    rs.username = "mitchellh"
    rs.api_key  = "foobarbaz"
    rs.disk_config  = "MANUAL"
  end
end

deleting files does not propagate during provision

We have a project where, during the course of development, certain source files were intentionally removed. I was surprised to discover that those deletions did not propagate to the Rackspace servers when I provisioned. I haven't had adequate time to test, but is there a reason why we aren't specifying the --delete flag with rsync somewhere in here?

On the plus side, this would properly deal with files being deleted. On the negative side, if users intentionally create internal project working directories, those might be deleted (which could be very bad). What is the appropriate behavior with this?

CentOS Image sudo tty error with Rsync

When provisioning a CentOS image, the following error appears at the Rsync step:

[node02] Rsyncing folder: /Users/trerober/Development/puppet-course/ => /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p '/vagrant'

Stdout from the command:

Stderr from the command:

sudo: sorry, you must have a tty to run sudo

The /vagrant folder is never created. This issue doesn't happen with Ubuntu images.

plugin installation fails

Hi All!

tried to install the plugin on my windows7 (32 bits) and installation failed with no error message. how can I make it more verbose?

all I get is: Installing the 'vagrant-rackspace' plugin. This can take a few minutes...
and then it exists without installing the plugin.
by the way, I'm using ruby 2.0.0p247 and vagrant 1.2.7

thanks

Issue trying to bring up a server

I have been trying for the better portion of the day to get around why this is not working.

I am running:
OSX 10.8.5
Vagrant 1.3.4
vagrant-rackspace (0.1.3)

I have a local brew installation as well as a local Ruby installation.

After having built my Vagrantfile and attempting to run:

vagrant up --provider=rackspace

I get this error:

WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
Bringing machine 'master' up with 'rackspace' provider...
/Users/gsm/.vagrant.d/gems/gems/excon-0.25.3/lib/excon/connection.rb:89:in `initialize': can't convert nil into String (TypeError)
    from /Users/gsm/.vagrant.d/gems/gems/excon-0.25.3/lib/excon.rb:135:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/excon-0.25.3/lib/excon.rb:135:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/connection.rb:33:in `initialize'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/compute_v2.rb:146:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/compute_v2.rb:146:in `initialize'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/service.rb:68:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/service.rb:68:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/compute.rb:29:in `new'
    from /Users/gsm/.vagrant.d/gems/gems/vagrant-rackspace-0.1.3/lib/vagrant-rackspace/action/connect_rackspace.rb:38:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/machine.rb:147:in `action'
    from /Users/gsm/.vagrant.d/gems/gems/vagrant-rackspace-0.1.3/lib/vagrant-rackspace/provider.rb:33:in `state'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/machine.rb:314:in `state'
    from /Users/gsm/.vagrant.d/gems/gems/vagrant-rackspace-0.1.3/lib/vagrant-rackspace/action/is_created.rb:10:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builtin/call.rb:43:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

I noted at least 7 different methods for getting rid of the Nokogiri warning, none have so far worked.

At this point I am at a loss. I have tried literrally everything short of rebuilding my OSX from scratch (which may be my only recourse if I can't get this running in a reasonable timeframe).

Help?

Keep getting server is already created after changing the rs.server_name in the Vagrantfile

jorgeastorgar:[vagrant-rackspace] vagrant up --provider=rackspace
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
Bringing machine 'default' up with 'rackspace' provider...
[default] The server is already created.

Bringing machine 'default' up with 'rackspace' provider...
[default] The server is already created.

Problem:
The image gets launched successfully the first time I run it, but after I change the rs.server_name field in the Vagrantfile, I keep getting the message above. Is there any way to just change the name of the server to launch another server in RS?

Thank you,
Jorge

vagrant provision fails

$ vagrant provision
Vagrant attempted to call the action 'provision' on the provider
'RackSpace Cloud', but this provider doesn't support this action. This
is probably a bug in either the provider or the plugin calling this
action, and should be reported.

Described in the second part of #3, but I'm creating a new ticket for clarity.

--cvs-exclude option arbitrarily excludes "myapp/core" from sync_folders action

Not being from the age of CVS, I am not exactly sure why "myapp/core" directory is excluded from the sync_folders action. It took a minute to narrow this down, but ultimately ... I grabbed the exact rsync command that is getting run and removed the "--cvs-exclude" option which resolve my issue.

My vagrant root directory is a Python project, for this purpose called "myapp". This project has a number of modules (sub-directories) such as "myapp/ext", "myapp/cli", "myapp/tasks", and "myapp/core". These are all subdirectories under "myapp". The only directly that was not included in the rsync operation was "myapp/core". I copied "myapp/core" to "myapp/core2" and that was synced. I then narrowed down the issue to the "--cvs-exclude" option, and after removing that and running the rsync command manually the "myapp/core" directory is synced properly.

Is there some way that I am missing where this option can be excluded. Not using CVS here (didn't think anyone still did), so it is really inconvenient.

Any help is appreciated!

SSH output from shell provisioner hangs

We use shell provisioner script to install puppet and some other packages via Yum. We noticing that vagrant is able to create/boot a cloud server correctly, RSYNC is also fine and it is able to launch the shell provisioner script. However, it appeared initially that the provisioner script is hanging. On further investigations we found that the script is actually completing fine on the cloud server but due to some reason, vagrant output (from the script) seems to be hanging and vagrant not returning correctly (error or success).

Our vagrant file is as below

ENV['VAGRANT_DEFAULT_PROVIDER'] = 'rackspace'
Vagrant.configure("2") do |config|

config.vm.box = "dummy"
config.vm.hostname = "web"
config.ssh.private_key_path = "/root/id_rsa"
config.ssh.username = "root"
config.ssh.pty = "true"

config.vm.provider "rackspace" do |rs, override|
rs.username = "xxx"
rs.api_key = "xxx"
rs.flavor = /512MB/
rs.image = /CentOS/
rs.rackspace_region = "lon"
rs.server_name = "web1.domain.com"
rs.public_key_path = "/root/id_rsa.pub"
override.ssh.username = "root"
end

config.vm.provision "shell", path: "boot.sh", args: "-r webserver -e production"

config.ssh.shell = "bash -l"
#config.ssh.keep_alive = true
config.ssh.forward_agent = false
config.ssh.forward_x11 = false
#config.vagrant.host = :detect

end

boot.sh is simply a shell file with couple of yum commands.

!/bin/bash

set -x

Install PUPPET from puppetlabs.com repo

yum install -y http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum install -y puppet
yum install -y git
...
...

The output from Vagrant is as below (just the bottom bit where it hangs)

  • yum install -y puppet
    ...
    ...
    ...
    ...
    Total download size: 6.0 M
    Installed size: 20 M
    Downloading Packages:
    (1/18): augeas-libs-1.0.0-5.el6_5.1.x86_64.rpm | 309 kB 00:00
    (2/18): compat-readline5-5.2-17.1.el6.x86_64.rpm | 130 kB 00:00
    (3/18): dmidecode-2.11-2.el6.x86_64.rpm | 71 kB 00:00
    (4/18): facter-1.7.5-1.el6.x86_64.rpm | 87 kB 00:00
    (5/18): hiera-1.3.2-1.el6.noarch.rpm | 23 kB 00:00
    (6/18): libselinux-ruby-2.0.94-5.3.el6_4.1.x86_64.rpm | 99 kB 00:00
    (7/18): pciutils-3.1.10-2.el6.x86_64.rpm | 85 kB 00:00
    (8/18): puppet-3.4.3-1.el6.noarch.rpm | 1.1 MB 00:01
    (9/18): ruby-1.8.7.352-13.el6.x86_64.rpm | 534 kB 00:00
    (10/18): ruby-augeas-0.4.1-3.el6.x86_64.rpm | 21 kB 00:00
    (11/18): ruby-irb-1.8.7.352-13.el6.x86_64.rpm | 314 kB 00:00
    (12/18): ruby-libs-1.8.7.352-13.el6.x86_64.rpm | 1.6 MB 00:00
    (13/18): ruby-rdoc-1.8.7.352-13.el6.x86_64.rpm | 377 kB 00:00
    (14/18): ruby-rgen-0.6.5-2.el6.noarch.rpm | 237 kB 00:00
    (15/18): ruby-shadow-2.2.0-2.el6.x86_64.rpm | 13 kB 00:00
    (16/18): rubygem-json-1.5.5-1.el6.x86_64.rpm | 763 kB 00:00
    (17/18): rubygems-1.3.7-5.el6.noarch.rpm | 207 kB 00:00
    (18/18): virt-what-1.11-1.2.el6.x86_64.rpm | 24 kB 00:00

    Total 1.5 MB/s | 6.0 MB 00:03
    warning: rpmts_HdrFromFdno: Header V4 RSA/SHA512 Signature, key ID 4bd6ec30: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
    Importing GPG key 0x4BD6EC30:
    Userid : Puppet Labs Release Key (Puppet Labs Release Key) [email protected]
    Package: puppetlabs-release-6-10.noarch (@/puppetlabs-release-el-6.noarch)
    From : /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
    Running rpm_check_debug
    Running Transaction Test <- Here is where it hangs and sits for ages...

The strange thing is that it won't always hang here. Sometime it will hang at a stage where yum is downloading the packages. And as mentioned above, the script completes successfully on the destination server, it is just that it is not able to display full output and status via vagrant.

I tried setting / unsetting SSH Keep alive within Vagrant file but no avail.

#config.ssh.keep_alive = true

Provisioner fail

This seems kinda borked, too:

[sam@dirac:~/ODI/rackspace] vagrant up --provider rackspace
Bringing machine 'default' up with 'rackspace' provider...
[default] Warning! The Rackspace provider doesn't support any of the Vagrant
high-level network configurations (`config.vm.network`). They
will be silently ignored.
[default] Finding flavor for server...
[default] Finding image for server...
[default] Launching a server with the following settings...
[default]  -- Flavor: 512MB Standard Instance
[default]  -- Image: Ubuntu 12.04 LTS (Precise Pangolin)
[default]  -- Name: default
[default] Waiting for the server to be built...
[default] Waiting for SSH to become available...
[default] The server is ready!
[default] Rsyncing folder: /Users/sam/ODI/rackspace/ => /vagrant
The authenticity of host '162.13.4.118 (162.13.4.118)' can't be established.
RSA key fingerprint is 36:d2:31:94:fb:02:6d:e1:19:b8:0c:b4:09:99:e5:51.
Are you sure you want to continue connecting (yes/no)? yes
[default] Running provisioner: VagrantPlugins::Chef::Provisioner::ChefClient...
The chef binary (either `chef-solo` or `chef-client`) was not found on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the binary is available on the PATH.

and this:

[sam@dirac:~/ODI/rackspace] vagrant provision
Vagrant attempted to call the action 'provision' on the provider
'RackSpace Cloud', but this provider doesn't support this action. This
is probably a bug in either the provider or the plugin calling this
action, and should be reported.

Am I missing something here?

S

rsync fails on debian 6

There was an error when attemping to rsync a share folder.
Please inspect the error message below for more info.

Host path: /Users/cdracars/Box Documents/Shawnee_Theming/
Guest path: /vagrant
Error: Warning: Permanently added 'xxx.xx.xxx.xxx' (RSA) to the list of known hosts.
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]

intelligently avoid rsyncing .hg/, .git/, etc. and anything listed in ignore files

Love the plugin.

One thing I noticed is that it takes for-ev-a to rsync the first time with a relatively mature project repository. I've ended up using some relatively hacky workarounds to deploy code to rackspace to avoid rsyncing everything in .hg directories. The --cvs-exclude is a good starting point for rsync, but probably we could come up with a good list of rsync exclude patterns to avoid the usual suspects and obey the rules in .hgignore and .gitignore files.

Possible to disable default rsync behavior?

My rsync needs are different enough from the default actions of this plugin that I would like to toggle off that default behavior and do my own thing with config.vm.synced_folder ....

How can I accomplish that? I searched around in the plugin's source code but it wasn't clear to me what I should do.

Thank you.

HTTP 413 Fog::Compute::RackspaceV2::ServiceError

Hello,

I have been trying to start up a rackspace box with the most basic (and not so basic combinations) Vagrantfile, which is similiar to this (but with valid username/api_key):

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # vagrant box add dummy https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box
  config.vm.box = "dummy"
  config.vm.provider :rackspace do |rs|
    rs.username = "username"
    rs.api_key = "api_key"
  end
end

However, not matter what I try, I always get 413 HTTP (Request entity too large) exception with the following output:

$ vagrant up --provider=rackspace
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
Bringing machine 'default' up with 'rackspace' provider...
[default] Warning! The Rackspace provider doesn't support any of the Vagrant
high-level network configurations (`config.vm.network`). They
will be silently ignored.
[default] Finding flavor for server...
[default] Finding image for server...
[default] Warning! By not specifying a custom public/private keypair,
Vagrant is defaulting to use the insecure keypair that ships with
Vagrant. While this isn't much of a big deal for local development,
this is quite insecure for remote servers. Please specify a custom
public/private keypair.
[default] Launching a server with the following settings...
[default]  -- Flavor: 512MB Standard Instance
[default]  -- Image: Ubuntu 13.10 (Saucy Salamander)
[default]  -- Name: default
/home/ed/.vagrant.d/gems/gems/excon-0.25.3/lib/excon/middlewares/expects.rb:10:in `response_call': [HTTP 413 | ] Fog::Compute::RackspaceV2::ServiceError (Fog::Compute::RackspaceV2::ServiceError)
    from /home/ed/.vagrant.d/gems/gems/excon-0.25.3/lib/excon/middlewares/response_parser.rb:8:in `response_call'
    from /home/ed/.vagrant.d/gems/gems/excon-0.25.3/lib/excon/connection.rb:349:in `response'
    from /home/ed/.vagrant.d/gems/gems/excon-0.25.3/lib/excon/connection.rb:247:in `request'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/connection.rb:57:in `request'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/deprecated/connection.rb:20:in `request'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/service.rb:36:in `request'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/compute_v2.rb:150:in `request'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/requests/compute_v2/create_server.rb:68:in `create_server'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/models/compute_v2/server.rb:211:in `create'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/rackspace/models/compute_v2/server.rb:179:in `save'
    from /home/ed/.vagrant.d/gems/gems/fog-1.15.0/lib/fog/core/collection.rb:52:in `create'
    from /home/ed/.vagrant.d/gems/gems/vagrant-rackspace-0.1.4/lib/vagrant-rackspace/action/create_server.rb:67:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/ed/.vagrant.d/gems/gems/vagrant-rackspace-0.1.4/lib/vagrant-rackspace/action/warn_networks.rb:14:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/ed/.vagrant.d/gems/gems/vagrant-rackspace-0.1.4/lib/vagrant-rackspace/action/sync_folders.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/provision.rb:54:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/ed/.vagrant.d/gems/gems/vagrant-rackspace-0.1.4/lib/vagrant-rackspace/action/connect_rackspace.rb:40:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/machine.rb:147:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

Trying to search for a related has not been fruitful. Any help pointing out what I am missing would be greatly appreciated.

Regards,
Ed

Rsync tty issues

Hello!

So, trying to kick up a new Rackspace server. Config looks a little like this:

require 'yaml'
require_relative "vagrant_requires.rb"

# Looking at a credentail file as opposed to having it in the config file
RS_CONFIG = YAML.load_file(ENV['HOME']+'/.rax_cred')
RS_USER = RS_CONFIG['rackspace']['user']
RS_KEY = RS_CONFIG['rackspace']['api_key']

# Setting a shell variable to default to Rackspace as the provider
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'rackspace'

Vagrant.configure("2") do |config|

  config.puppet_install.puppet_version = :latest
  config.vm.box = "benhamine/dummy"

  config.vm.provider :rackspace do |rs, override|
    rs.username = RS_USER
    rs.api_key  = RS_KEY
    rs.rackspace_region = :lon
    rs.flavor   = /512MB Standard Instance/
    rs.image    = /CentOS 6.5/
    rs.disk_config = "AUTO"
    rs.rackconnect = true
    rs.public_key_path = './keys/key.pub'
    override.vm.synced_folder ".", "/vagrant", type: "rsync"
  end

  config.ssh.pty = true

  config.ssh.private_key_path = './keys/key'

  config.vm.define "web" do |web|
    config.vm.provider :rackspace do |web|
      web.server_name = "web"
      web.key_name = 'Bootstrap_Key'
    end
    config.vm.provision "shell", path: "bootstrap.sh"
  end
end

Everythings all dandy, until it tries to rsync the current folder to /vagrant (the default option):

There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/peterso/Projects/foo-project/
Guest path: /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/peterso/Projects/foo-project/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i  '/Users/peterso/Projects/foo-project/keys/bootstrap' --exclude .vagrant/ /Users/peterso/Projects/foo-project/ root@[REDACTED]:/vagrant
Error: Warning: Permanently added '[REDACTED]' (RSA) to the list of known hosts.
sudo: sorry, you must have a tty to run sudo
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]

Side note: Would it be better to surround the -e argument in quotes to make it a bit more readable? Might make a separate issue for that...

This then works fine if I do a sed on the /etc/sudoers and remove the require tty line. But that's an extra step I'd rather avoid.

Could we an an extra step to either:

  1. Add -t -t to the ssh command to force tty
  2. Remove requiretty from the sudoers file
  3. Some other better idea ๐Ÿ‘

vagrant-rackspace 0.1.3 failed to load with Vagrant 1.3.x

I'm seeing "failed to load" errors with version 0.1.3 on Vagrant 1.3.x (the following transcript is with 1.3.1, but I also saw the same problem with 1.3.0):

$ vagrant --version
Vagrant 1.3.1

$ vagrant plugin list
nugrant (1.1.0)
vagrant-aws (0.3.0)
vagrant-berkshelf (1.3.3)
vagrant-chef-zero (0.4.0)
vagrant-omnibus (1.1.1)
vagrant-rackspace (0.1.2)
vagrant-vmware-fusion (2.0.1)

$ vagrant plugin update vagrant-rackspace
Installing the 'vagrant-rackspace' plugin. This can take a few minutes...
Installed the plugin 'vagrant-rackspace (0.1.3)'!

$ vagrant box list
Failed to load the "vagrant-rackspace" plugin. View logs for more details.

opscode_centos-5.9_provisionerless          (virtualbox)
opscode_centos-6.4_provisionerless          (virtualbox)
opscode_debian-7.1.0_provisionerless        (virtualbox)
opscode_fedora-19_provisionerless           (virtualbox)
opscode_ubuntu-10.04_provisionerless        (virtualbox)
opscode_ubuntu-12.04_provisionerless        (virtualbox)
opscode_ubuntu-13.04_provisionerless        (virtualbox)
packer_vmware_vmware                        (vmware_desktop)
precise-server-cloudimg-amd64-vagrant-disk1 (virtualbox)
precise64                                   (virtualbox)
precise64_vmware                            (vmware_fusion)
ubuntu                                      (virtualbox)

$ vagrant plugin uninstall vagrant-rackspace
Uninstalling the 'vagrant-rackspace' plugin...

$ vagrant plugin install vagrant-rackspace --plugin-version 0.1.2
Installing the 'vagrant-rackspace --version '0.1.2'' plugin. This can take a few minutes...
Installed the plugin 'vagrant-rackspace (0.1.2)'!

$ vagrant box list
opscode_centos-5.9_provisionerless          (virtualbox)
opscode_centos-6.4_provisionerless          (virtualbox)
opscode_debian-7.1.0_provisionerless        (virtualbox)
opscode_fedora-19_provisionerless           (virtualbox)
opscode_ubuntu-10.04_provisionerless        (virtualbox)
opscode_ubuntu-12.04_provisionerless        (virtualbox)
opscode_ubuntu-13.04_provisionerless        (virtualbox)
packer_vmware_vmware                        (vmware_desktop)
precise-server-cloudimg-amd64-vagrant-disk1 (virtualbox)
precise64                                   (virtualbox)
precise64_vmware                            (vmware_fusion)
ubuntu                                      (virtualbox)

I'm not sure where to find the "logs" referred to, but if you tell me where they are I can rerun this process and grab the appropriate log output.

Multi-node IP Information

For multi-node setups, it would be useful if vagrant-rackspace can accommodate at least one of the following behaviors:

  1. Allow Vagrant to set the node IP address for private networks created\specified in the Vagrantfile
  2. Allow VMs in a multi-VM Vagrantfile to obtain each other's IP address (ex: configure /etc/hosts for a Puppet Master automatically on Puppet Agent hosts)

Is either option currently possible with vagrant-rackspace? If not, is there a workaround that anyone can share?

Quick-fix scenario would be for the user to output the IP address on a vm into a text file and "reverse rsync" it to the Vagrant user desktop to use with the VMs that get created it after it.

Alternatively, "vagrant ssh-config" is aware of each VM's IP address. If somehow this data could be used, that could also be helpful.

RackConnect error - Cloud Server Created: Update access on dedicated network devices

I use the RackConnect service and the "RackConnect automation" is failing at the step
"Cloud Server Created: Update access on dedicated network devices"

RS tech support says "RC automation requires SSH access using the default root username/password in order to create "RackConect" username/password and this is used in the future for making any alterations to the cloud server. Please, note that the "rackconnect" user will be logging in via SSH on port 22 and if this is disabled or if the IPTable is altered manually, automation will fail to proceed."

Eternal hang at "Waiting for SSH to become available"

I suppose this is likely an issue with Fog more so than vagrant-rackspace, however it should be noted here. Last night half a dozen or so of our builds hung up at "Waiting for SSH to become available" and sat there all night long in that state. In Rackspace I could see that the box was active, but trying "vagrant ssh" also hung manually... and simply "ssh [email protected]" also hung.

As we are using Vagrant for automated testing, etc... I would have expected Vagrant to timeout at some point... am I missing something, or shouldn't this already be implemented?

Thanks.

uninitialized constant Vagrant::VM

Hey guys,

when I have installed the vagrant-rackspace plugin I always get a "uninitialized constant Vagrant::VM" exception.

It is not only plugin related. Vagrant is not working at all with that plugin.
Only uninstalling the plugin works.

   .....
Here is a snippiet of the debug output "vagrant --debug"
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/kernel_v1/ plugin.rb
INFO manager: Registered plugin: kernel
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/communicators/ssh/plugin.rb
INFO manager: Registered plugin: ssh communicator
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/kernel_v2/ plugin.rb
INFO manager: Registered plugin: kernel
INFO global: Loading plugins!
INFO manager: Registered plugin: vagrant-login
INFO manager: Registered plugin: vagrant-share
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::PluginLoadError: The plugins failed to load properly. The error   message given is shown below.

uninitialized constant Vagrant::VM>
ERROR vagrant: The plugins failed to load properly. The error message given is shown below.

uninitialized constant Vagrant::VM
ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant.rb:264:in `rescue in <top  (required)>'
/opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant.rb:260:in `<top (required)>'
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.1/bin/vagrant:95:in `require'
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.1/bin/vagrant:95:in `<main>'
Vagrant failed to initialize at a very early stage:
     The plugins failed to load properly. The error message given is shown below.
   uninitialized constant Vagrant::VM

Vagrant version: 1.5.1

Installed plugins:

vagrant-aws (0.0.1)
vagrant-login (1.0.1, system)
vagrant-rackspace (0.1.7)
vagrant-share (1.0.1, system)

Any ideas?

Edit:
It seems that the vagrant-rackspace and vagrant-aws plugins have an affect on each other. If I uninstall the vagrant-aws plugin the rackspace one is working.

Don't error out when connection is lost

Below is the stacktrace I got when I lost internet connection during vagrant up. Would be nice if the plugin were a little more resilient to dropped connections. Perhaps it could inform you that the connection appears lost, and give you the option to exit or retry and pick up where it left off?

[default]  -- Image: Ubuntu 10.04 LTS (Lucid Lynx)
[default]  -- Name: testing123-ci
[default] Waiting for the server to be built...
Progress: 0%/Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:177:in `rescue in block in connect': connect timeout reached (Excon::Errors::Timeout)
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:156:in `block in connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:152:in `each'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:152:in `connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/ssl_socket.rb:92:in `connect'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/socket.rb:32:in `initialize'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/ssl_socket.rb:8:in `initialize'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:359:in `new'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:359:in `socket'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:105:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/mock.rb:55:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/instrumentor.rb:22:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from /Users/patcon/.vagrant.d/gems/gems/excon-0.21.0/lib/excon/connection.rb:238:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/connection.rb:21:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/compute_v2.rb:141:in `request'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/requests/compute_v2/get_server.rb:45:in `get_server'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/rackspace/models/compute_v2/servers.rb:57:in `get'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:40:in `reload'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:66:in `block in wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/wait_for.rb:5:in `wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/fog-1.10.1/lib/fog/core/model.rb:65:in `wait_for'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/create_server.rb:80:in `block in call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/retryable.rb:17:in `retryable'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/create_server.rb:70:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/warn_networks.rb:14:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/sync_folders.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/provision.rb:45:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-librarian-chef-0.0.1/lib/vagrant-librarian-chef/action/librarian_chef.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/patcon/.vagrant.d/gems/gems/vagrant-rackspace-0.1.1/lib/vagrant-rackspace/action/connect_rackspace.rb:32:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

Add option to create image upon `vagrant destroy`

We're using this (great!) plugin as part of our Jenkins setup. Jenkins itself is running on a Rackspace VM and jobs are spawned via this plugin.

The Jenkins job creates the VM which is then provisioned via Ansible (plus an intermediary step to build a dynamic Ansible inventory, harnessing vagrant ssh-config).

As the plugin doesn't support vagrant suspend it would be very useful for us if we could take an image of the Rackspace VM created via the vagrant-rackspace plugin prior to VM deletion. This image could then become the base for the next vagrant up.

This would speed up the process greatly as the Ansible playbook execution would have much less to do to get the box into the desired state, it would also be a more realistic test of our playbooks as they would normally be used to update a VM rather than provision from scratch.

It could be used something like:

config.vm.provider :rackspace do |rs|
  rs.server_name = 'my_app_server'
  rs.flavor = /1 GB/
  rs.image_on_destroy = true # <-- suggestion
  rs.image = /Ubuntu/
end

Upon vagrant destroy an image named vagrant__my_app_server would be created and saved. Next time vagrant up is called the plugin will look for an image named vagrant__my_app_server and use this if present, else it would fall back to using the default /Ubuntu/ image.

I'm happy to have a crack at integrating this functionality if it is felt it would be useful.

Thanks!
๐Ÿ˜„

Failures on vagrant plugin install vagrant-rackspace

I have an rvm installation of ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]. Following the advice at http://nokogiri.org/tutorials/installing_nokogiri.html suggests that I install a bunch of ruby-1.8 packages using apt-get (Debian Squeeze). I've translated that to ruby-1.9.1 (available in my APT repos). One question is this: Will pulling that code from the debian install break things which are (mostly) working under the rvm install of ruby?

I have documented the stack trace I see and the logs I find here: https://gist.github.com/hesco/5471100

The missing header file is there, and if I understand things correctly, is even in the correct path. Can anyone please help me get this installed?

Thanks,
-- Hugh Esco

UPDATE --

This issue is still unresolved for me. I have posted an update on the things I have tried here:
https://community.rackspace.com/developers/f/7/p/558/904#904

vagrant halt does not work.

When running vagrant halt the following is displayed

C:\VM\rackspace>vagrant halt
Vagrant attempted to call the action 'halt' on the provider
'RackSpace Cloud', but this provider doesn't support this action. This
is probably a bug in either the provider or the plugin calling this
action, and should be reported.

`vagrant provision` requires password when rsyncing with Vagrant 1.4.1

I just got a new computer and installed a fresh version of Vagrant (1.4.1) and the vagrant-rackspace plugin. My colleagues, who are still running Vagrant 1.2.2, can provision this machine without being asked for a password. However, when I tried to provision this machine, it asked me for a password:

[deep-thought]$ vagrant provision my-machine
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
[my-machine] Rsyncing folder: /Users/rdm/Projects/XXXX/ => /vagrant
[email protected]'s password: 

Oddly, I can vagrant ssh my-machine just fine. Any ideas what might be causing this problem, @mitchellh? I'm happy to dig in and try to issue a PR.

dependency on zlib headers

Hi,

I just saw "vagrant plugin install vagrant-rackspace" fail on a mostly fresh ubuntu 13.10; the error messages pointed to nogokiri's compile.log, which had some linker errors, with function names that lead me to install zlib1g-dev from APT.

Indeed, the subsequent plugin install succeeded. That is, all it takes to fix this is installing zlib1g-dev. Not sure how you do dependency-handling, so apologies for not providing a patch, but hope it helps anyway!

Conflict with 1.5's built in rsync folder type

So that I have more control of which files are synchronised I want to use the built in rsync folder type [http://docs.vagrantup.com/v2/synced-folders/rsync.html] But the rackspace provider ignores my config settings and runs its own rsync code that doesn't take into account the rsync__exclude and rsync__args options.

InvalidServerStateException not handled

I've received this a few times. It might be upgrade time, vagrant-rackspace is tied to an old version of Fog.

An unexpected error ocurred when executing the action on the
'Ubuntu 12.04 LTS (Precise Pangolin)' machine. Please report this as a bug:

undefined local variable or method `state' for #<Fog::Compute::RackspaceV2::InvalidServerStateException:0x007f87a9e89f08>

/Users/Thoughtworker/.rvm/gems/ruby-1.9.3-p392@rackspace/gems/fog-1.10.1/lib/fog/rackspace/compute_v2.rb:24:in `to_s'
/Users/Thoughtworker/repos/rackspace/vagrant-rackspace/lib/vagrant-rackspace/action/create_server.rb:89:in `message'

Performance Flavor Documentation

We need to update the documentation to include information about performance flavors as well as updating vagrant-rackspace to include a deprecation notice about a future default flavor change.

Looking up images/flavors by exact name is broken

Vagrant rackspace is supposed to be able to look up images as a regex, an exact string, or by ID.

So the vagrant file below should work (vagrant up --provider rackspace brings them up all, or specify a machine name to test one at a time), but the "exact_name" was broken by the recent changes in #101.

# -*- 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.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "dummy"

  config.vm.provider :rackspace do |rs|
    rs.username = ENV['RAX_USERNAME']
    rs.api_key  = ENV['RAX_API_KEY']
    rs.rackspace_region   = :ord
  end

  config.vm.define :exact_name do |box|
    box.vm.provider :rackspace do |rs|
      rs.flavor = '1 GB Performance'
      rs.image  = 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)'
    end
  end

  config.vm.define :regex do |box|
    box.vm.provider :rackspace do |rs|
      rs.flavor = /1\s+GB\s+Performance/
      rs.image  = /Ubuntu.*Trusty Tahr.*(PVHVM)/
    end
  end

  config.vm.define :id do |box|
    box.vm.provider :rackspace do |rs|
      rs.flavor = 'performance1-1'
      rs.image  = 'bb02b1a3-bc77-4d17-ab5b-421d89850fca'
    end
  end
end

The error is:

Bringing machine 'exact_name' up with 'rackspace' provider...
Bringing machine 'regex' up with 'rackspace' provider...
Bringing machine 'id' up with 'rackspace' provider...
==> exact_name: Finding flavor for server...
/opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/excon-0.37.0/lib/excon/middlewares/expects.rb:6:in `response_call': [HTTP 400 | ] Expected([200, 203]) <=> Actual(400 Bad Request) (Fog::Compute::RackspaceV2::BadRequest)
  response => #<Excon::Response:0x007fafdd67c8e0 @data={:body=>"", :headers=>{"Content-Length"=>"0", "Connection"=>"close", "Server"=>"Jetty(8.0.y.z-SNAPSHOT)"}, :status=>400, :remote_ip=>"198.101.165.140", :local_port=>61865, :local_address=>"192.168.1.23"}, @body="", @headers={"Content-Length"=>"0", "Connection"=>"close", "Server"=>"Jetty(8.0.y.z-SNAPSHOT)"}, @status=400, @remote_ip="198.101.165.140", @local_port=61865, @local_address="192.168.1.23"> -
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/excon-0.37.0/lib/excon/middlewares/response_parser.rb:26:in `response_call'

Allow for arbitrary number of public keys

The current implementation allows for a single public key. For the purposes of remote pairing, it would be helpful to allow for an arbitrary number of public keys.

vagrant reload does not work

Based on the documentation, it seemed like the vagrant reload command would work, but I receive an error when I run it:

[unix]$ vagrant reload
Vagrant attempted to call the action 'reload' on the provider
'RackSpace Cloud', but this provider doesn't support this action. This
is probably a bug in either the provider or the plugin calling this
action, and should be reported.
[unix]$ vagrant --version
Vagrant version 1.2.2

What other information would be helpful for debugging here?

Cannot find flavor

I am using following flavor setting which used to work fine few month ago:

rs.flavor          = /4GB/

But now I am getting an error:

[server1] Finding flavor for server...
No matching flavor was found! Please check your flavor setting
to make sure you have a valid flavor chosen.

vagrant destroy deletes server without confirmation.

Expected behavior:

> vagrant destroy solr-dev
    solr-dev: Are you sure you want to destroy the 'solr-dev' VM? [y/N] 

Actual Behavior:

> vagrant destroy solr-live
==> solr-live: Deleting server...
==> solr-live: Running cleanup tasks for 'file' provisioner...
==> solr-live: Running cleanup tasks for 'chef_solo' provisioner...

No host IP was given to the Vagrant core NFS helper.

I've created a gist of the log file and vagrantfile being used.

https://gist.github.com/brettswift/79f52974075f9f1fc1cd

This happens on vagrant up and subsequently on vagrant provision.

This is my first time trying to get the rackspace plugin working, so it may be some configuration in the Vagrantfile I have wrong?

Vagrant version: 1.5.3

I have a couple of other provider plugins as well as oscar but they shouldn't be impacting this I wouldn't think.

I'm able to ssh into the box after this error.

User 'vagrant' not created, unable to SSH, or complete vagrant up

On initial $ vagrant up, it appears that the Vagrant user is not created, which is expected.

However, when reaching SyncFolders::call env[:machine].communicate.sudo("mkdir -p '#{guestpath}'") it's dying because it's trying to use env[:machine].ssh_info which contains:

{:host=>"166.78.xx.xx", :port=>22, :username=>"vagrant", :private_key_path=>"/Users/jtreminio/.ssh/id_rsa", :forward_agent=>false, :forward_x11=>false}

which means it's trying to do ssh [email protected] which fails.

However, manually doing ssh [email protected] connects me fine.

A proper solution would be to have it try to connect with a defined ssh username, as here:

mitchellh/vagrant-aws#48 (comment)

I'm a PHP developer, however, and know not one lick of Ruby so I can't proceed on this.

rsync fails on vagrant up with rackconnect accounts

When I do a vagrant up with a Rackspace account that has Rackconnect I get a timeout on the initial rysnc command. After the timeout if I do a vagrant provision, the rest of the process works as expected. If I switch to a regular cloud account I don't get that error on a vagrant up and it's all fine.

Any ideas why that may be happening?

Parallel provisioning?

When running a 'vagrant up' on a multi-vm config, each vm is loaded serially. Is parallel provisioning supposed to be the default option? Is there a way to enable it?

Bundle fail

Hi

So currently this doesn't work for me - I need to specify the auth_url (because we're in London). I have a fix (I hacked it into the local copy of the plugin) and so I'd like to clean this up in my fork and submit a PR. But I appear to have entered Dependency Hell:

[sam@dirac:~/Github/vagrant-rackspace] bundle update
Updating git://github.com/mitchellh/vagrant.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Bundler could not find compatible versions for gem "net-scp":
  In Gemfile:
    vagrant-rackspace (>= 0) ruby depends on
      net-scp (~> 1.0.4) ruby

    vagrant (>= 0) ruby depends on
      net-scp (1.1.0)

Am I doing something dumb or is this just borked?

Alternatively, I could just show you how I hacked it :)

Sam

Send shell command before rsync

Here's my Vagrantfile:

ENV['VAGRANT_DEFAULT_PROVIDER'] = 'rackspace'

 Vagrant.configure("2") do |config|
   config.ssh.private_key_path = "~/.ssh/id_rsa"
   config.ssh.username = "jtreminio"

   config.vm.box = "dummy"

   config.vm.hostname = "master"
   config.vm.provider :rackspace do |rs, override|
     rs.username           = "xxx"
     rs.api_key            = "xxx"
     rs.flavor             = /4GB/
     rs.image              = "CentOS 6.4"
     rs.rackspace_region   = "dfw"
     rs.public_key_path    = "~/.ssh/id_rsa.pub"
     rs.server_name        = "rackspace-server-centos"
     override.ssh.username = "root"
   end

   config.vm.synced_folder "./", "/var/www", id: "webroot"

   config.vm.provision :shell, :path => "shell/initial-setup.sh"
   config.vm.provision :shell, :path => "shell/update-puppet.sh"
   config.vm.provision :shell, :path => "shell/librarian-puppet-vagrant.sh"
   config.vm.provision :puppet do |puppet|
     puppet.facter = {
       "ssh_username" => "jtreminio"
     }

     puppet.manifests_path = "puppet/manifests"
     puppet.options = ["--verbose", "--hiera_config /vagrant/hiera.yaml", "--parser future"]
   end

   config.ssh.shell = "bash -l"
   config.ssh.keep_alive = true
   config.ssh.forward_agent = false
   config.ssh.forward_x11 = false
   config.vagrant.host = :detect
 end

I want to use the RS CentOS 6.4 image. However, on $ vagrant up I get:

[default] Launching a server with the following settings...
[default]  -- Flavor: 4GB Standard Instance
[default]  -- Image: CentOS 6.4
[default]  -- Name: rackspace-server-centos
[default] Waiting for the server to be built...
[default] Waiting for SSH to become available...
[default] The server is ready!
[default] Rsyncing folder: /Users/jtreminio/www/temp/ylSe7I/ => /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p '/vagrant'

Stdout from the command:



Stderr from the command:

sudo: sorry, you must have a tty to run sudo

Solution would be to run what's here: https://github.com/mitchellh/vagrant-aws/wiki/Amazon-Linux-AMI

This would need to be run before Vagrant attempts to rsync. If you could provide a command that is executed immediately after ssh is available, and before rsync is called, it would completely resolve this issue.

Error Standing Up Vagrant Rackspace VM

Trying to stand up a server using the vagrant rackspace plugin. Encountered the following error message:

Bringing machine 'www.server01.sa.com' up with 'rackspace' provider...
[www.server01.sa.com] Finding flavor for server...
[www.server01.sa.com] Finding image for server...
[www.server01.sa.com] Launching a server with the following settings...
[www.server01.sa.com] -- Flavor: 1 GB Performance
[www.server01.sa.com] -- Image: Ubuntu 12.04 LTS (Precise Pangolin)
[www.server01.sa.com] -- Name: www.server01.sa.com
[www.server01.sa.com] Waiting for the server to be built...
[www.server01.sa.com] Waiting for SSH to become available...
[www.server01.sa.com] The server is ready!
No host IP was given to the Vagrant core NFS helper. This is
an internal error that should be reported as a bug.

Vagrant version 1.4.3
Vagrant Plugin version 0.1.9

Below is the response I received from Rackspace after posting a message with support:

Hello,

I don't believe that Vagrant is supported by Rackspace, but rather the developer of Vagrant, Hashicorp. I can tell you that when you provision a server from the API as Vagrant would, it doesn't provide the IP, but does provide the root password. You can query what the IP is through the API though, so I believe that this is a simple API command that the application is sending incorrectly. I believe the quickest way to resolve this issue is to report it to HashiCorp either directly on their website, or more likely on the support section of the Vagrant website.

http://www.vagrantup.com/support

Please advise and thank you in advance,

Mark

Wrong key error

If I add the wrong api key, the install just hangs, instead of delivering an error message. Better would be an error with "auth failed, wrong key".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.