1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix issue where Vagrant AWS deploys outside of my dev account would fail

This commit is contained in:
Charles Hooper 2013-03-26 21:21:54 +00:00
parent 5cebc226cc
commit afdf29e57f
2 changed files with 31 additions and 15 deletions

4
Vagrantfile vendored
View file

@ -25,7 +25,7 @@ def v10(config)
# Assign this VM to a bridged network, allowing you to connect directly to a # Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another # network using the host's network device. This makes the VM appear as another
# physical device on your network. # physical device on your network.
# config.vm.network :bridged #config.vm.network :bridged
# Forward a port from the guest to the host, which allows for outside # Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not. # computers to access the VM, whereas host only networking does not.
@ -119,7 +119,7 @@ end
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"] aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"] aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
aws.region = "us-east-1" aws.region = "us-east-1"
aws.ami = "ami-4a7de623" aws.ami = "ami-4e75ee27"
aws.ssh_username = "ubuntu" aws.ssh_username = "ubuntu"
aws.instance_type = "t1.micro" aws.instance_type = "t1.micro"
end end

View file

@ -1,12 +1,26 @@
class virtualbox { class virtualbox {
Package { ensure => "installed" } Package { ensure => "installed" }
user { "vagrant":
name => "vagrant",
ensure => present,
comment => "Vagrant User",
shell => "/bin/bash",
home => "/home/vagrant",
}
file { "/home/vagrant":
mode => 644,
require => User["vagrant"],
}
# remove some files from the base vagrant image because they're old # remove some files from the base vagrant image because they're old
file { "/home/vagrant/docker-master": file { "/home/vagrant/docker-master":
ensure => absent, ensure => absent,
recurse => true, recurse => true,
force => true, force => true,
purge => true, purge => true,
require => File["/home/vagrant"],
} }
file { "/usr/local/bin/dockerd": file { "/usr/local/bin/dockerd":
ensure => absent, ensure => absent,
@ -23,10 +37,21 @@ class virtualbox {
} }
class ec2 { class ec2 {
user { "vagrant":
name => "ubuntu",
ensure => present,
comment => "Vagrant User",
shell => "/bin/bash",
home => "/home/ubuntu",
}
file { "/home/vagrant":
ensure => link,
target => "/home/ubuntu",
require => User["vagrant"],
}
} }
class docker { class docker {
# update this with latest docker binary distro # update this with latest docker binary distro
$docker_url = "http://get.docker.io/builds/$kernel/$hardwaremodel/docker-master.tgz" $docker_url = "http://get.docker.io/builds/$kernel/$hardwaremodel/docker-master.tgz"
# update this with latest go binary distry # update this with latest go binary distry
@ -44,19 +69,14 @@ class docker {
$ec2_version = file("/etc/ec2_version", "/dev/null") $ec2_version = file("/etc/ec2_version", "/dev/null")
if ($ec2_version) { if ($ec2_version) {
$vagrant_user = "ubuntu"
include ec2 include ec2
} else { } else {
$vagrant_user = "vagrant"
# virtualbox is the vagrant default, so it should be safe to assume # virtualbox is the vagrant default, so it should be safe to assume
include virtualbox include virtualbox
} }
user { "vagrant":
ensure => present,
comment => "Vagrant User",
shell => "/bin/bash",
home => "/home/vagrant",
}
file { "/usr/local/bin": file { "/usr/local/bin":
ensure => directory, ensure => directory,
owner => root, owner => root,
@ -83,14 +103,10 @@ class docker {
require => Exec["copy-docker-bin"], require => Exec["copy-docker-bin"],
} }
file { "/home/vagrant":
mode => 644,
require => User["vagrant"],
}
file { "/home/vagrant/.profile": file { "/home/vagrant/.profile":
mode => 644, mode => 644,
owner => "vagrant", owner => $vagrant_user,
group => "ubuntu", group => "ubuntu",
content => template("docker/profile"), content => template("docker/profile"),
require => File["/home/vagrant"], require => File["/home/vagrant"],