1

I'm trying to set up a clusterman/galaxy VM in VirtualBox using Vagrant and Fabric (through cloudbiolinux), and a critical step is to pass "user data" parameters to the VM. It's unclear (to me, at least) how this is injected into the VM.

How can I pass the equivalent to VirtualBox VMs managed by vagrant (assuming vagrant is an important variable here)?

1

2 Answers 2

1

How it works in AWS:

AWS uses an API to get both metadata and user-data visible to the VM. The important thing with user-data is the end result; usually presenting variables or running a script. In both cases the metadata is presented with their in-VM API accessed via URL in each instance (see links for further reading below). If the user-data begins with a shebang the instance knows to execute the user-data as a script. If the user-data does not begin with a shebang the instance does nothing automatically. Any init scripts on the instance can access the user-data via the URL mentioned above and use any key/value pairs it finds in executing scripts.

How it works in Vagrant:

The concept of AWS user-data doesn't exist. Instead the behavior can be mimicked using the provisioners in Vagrant. The easiest way to duplicate this behavior is with the shell provisioner (or chef/puppet if you're comfortable with those provisioners) in the way I mentioned above. The main distinction between Vagrant and AWS will be where the user-data resides: in AWS the user-data doesn't actually exist on the instance (API only) where-as with Vagrant you would have to store the user-data somewhere on the VM's filesystem. The scripts reading the user-data will need to understand this distinction.

Links for further reading:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html http://docs.vagrantup.com/v2/provisioning/index.html

0

Just a correction , the vagrant AWS plugin has an option to send user data:

User data

You can specify user data for the instance being booted.

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

config.vm.provider "aws" do |aws|

# Option 1: a single string
aws.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"

# Option 2: use a file
aws.user_data = File.read("user_data.txt")   end end 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .