fdcd9a51140379bdf5507a6def6f12b59c22ab1a
[releng/builder.git] / vagrant / rackspace-convert-base / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby sw=2 ts=2 sts=2 et :
3
4 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 VAGRANTFILE_API_VERSION = "2"
6
7 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8   # root off of the rackspace provider dummy box
9   config.vm.box = "dummy"
10
11   # rackspace systems even with cloud-init
12   # don't seem to have the cloud init user ${osname}
13   # getting the ssh key for some reason, root does
14   # so use that
15   config.ssh.username = 'root'
16   
17   # Fedora and EL systems default to requiring a tty for sudo
18   config.ssh.pty = true
19
20   # The rackspace provider by default tries to rsync
21   # the local folder / vagrant box to /vagrant
22   # unfortunately, even with config.ssh.pty = true
23   # this fails because it doesn't recognize the pty requirement
24   # when doing the sudo based rsync (not that it needs to sudo
25   # when doing things as root). To avoid this, disable the
26   # default sync, we don't need it anyway.
27   config.vm.synced_folder '.', '/vagrant', :disabled => true
28
29   # make sure to set the following in your
30   # ~/.vagrant.d/boxes/dummy/0/rackspace/Vagrantfile
31   # rs.username
32   # rs.api_key
33   # rs.rackspace_region
34   #
35   # If you are not using a SSH token / smartcard also set this
36   # rs.key_name
37   # config.ssh.private_key_path  -- set this outside the rackspace block
38   #         in your base box
39   config.vm.provider :rackspace do |rs|
40     # create these base builds always on the smallest system possible
41     rs.flavor = 'general1-1'
42
43     # allow for switching to ORD cloud but default to DFW
44     if (ENV['RSREGION'] == 'ord')
45       rs.rackspace_region = :ord
46     else
47       rs.rackspace_region = :dfw
48     end
49
50     # Default to the Fedora 20 image unless overridden by a RSIMAGE
51     # environment variable
52     if ENV['RSIMAGE']
53       rs.image = ENV['RSIMAGE']
54     else
55       rs.image = 'Fedora 20 (Heisenbug) (PVHVM)'
56     end
57   end
58
59   # Do a full system update and force enforcing on (it's in permissive
60   # by default in the rackspace base images)
61   config.vm.provision 'shell', path: 'bootstrap.sh'
62
63   # disable the default requiretty for sudo that Fedora and CentOS have
64   config.vm.provision 'shell', path: 'remove_requiretty.sh'
65
66   # Execute a system clean-up in prep for imaging so that this base
67   # image can be used for other Rackspace Vagrant configurations
68   config.vm.provision 'shell', path: 'system_reseal.sh'
69 end