Closed chipay closed 8 years ago
These are the files stored by Vagrant for your linode:
.vagrant/machines/default/linode/id (get it from the linode dashboard) .vagrant/machines/default/linode/creator_uid (501 is what I got for a Ubuntu VM) .vagrant/machines/default/linode/index_uuid (not sure where you could get this one from) .vagrant/machines/default/linode/synced_folders (a JSON file with a list of your folders)
I could see adding a LinodeID config option that would bypass the linode.create calls.
I have a similar problem, I've created some machines in linode but when I shared the vagrant file with a team member, they just get a list of boxes saying "Not Created (linode)". Without sending over the .vagrant directory, is there any way to "refresh" the mappings?
The knowledge of the Linode IDs created for each Vagrant config is stored in the .vagrant directory. If you try to attach to an existing Linode ID you're asking for trouble.
That said, you should be able to recreate the files vagrant-linode expects. If you want to share those values with another that has access to the Linode, make sure the SSH key that vagrant-linode uses is authorized for root on the target Linode.
For a Vagrant config named prod1-atlanta which should be attached to LinodeID 1712761:
NAME="prod1-atlanta"
LINODEID="1712761"
LINODEDIR=".vagrant/machines/$NAME/linode"
mkdir -p $LINODEDIR
echo "1.5:$LINODEID" > $LINODEDIR/action_provision
id -u > $LINODEDIR/creator_uid
echo "$LINODEID" > $LINODEDIR/id
uuidgen | tr A-Z a-z | sed s/-//g > $LINODEDIR/index_uuid
echo '{"rsync":{"/vagrant":{"rsync__exclude":[".git/","vendor/"],"guestpath":"/vagrant","hostpath":"'$(pwd)'","disabled":false,"__vagrantfile":true,"exclude":[".git/","vendor/"],"owner":"root","group":"root"}}}' > $LINODEDIR/synced_folders
The synced_folders
file could probably be skipped -- just running vagrant rsync
should recreate it.
Be mindful of your provisioning configuration.
I'm closing this as I don't think it is safe to provide a means of easily attaching. There are too many scary side-effects.
See also:
I created a linode using the plugin in my computer. I then wipe out my hard drive. I reinstalled all the projects but would like to manage the existing node with my old vagrant (I lost my .vagrant directory). Is it possible to get the info needed for that directory from Linode? Is it possible to have a 'attach' command for the vagrant linode plugin? Does it make sense? Thanks.