dd09c1b48e15f0e41eec20cb2ddded2056e81351
[releng/builder.git] / vagrant / baseline / 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   if (ENV['RSPTY'] == 'default')
19     config.ssh.pty = false
20   else
21     config.ssh.pty = true
22   end
23
24   # The rackspace provider by default tries to rsync
25   # the local folder / vagrant box to /vagrant
26   # unfortunately, even with config.ssh.pty = true
27   # this fails because it doesn't recognize the pty requirement
28   # when doing the sudo based rsync (not that it needs to sudo
29   # when doing things as root). To avoid this, disable the
30   # default sync, we don't need it anyway.
31   config.vm.synced_folder '.', '/vagrant', :disabled => true
32
33   # make sure to set the following in your
34   # ~/.vagrant.d/boxes/dummy/0/rackspace/Vagrantfile
35   # rs.username
36   # rs.api_key
37   # rs.rackspace_region
38   #
39   # If you are not using a SSH token / smartcard also set this
40   # rs.key_name
41   # config.ssh.private_key_path  -- set this outside the rackspace block
42   #         in your base box
43   config.vm.provider :rackspace do |rs|
44     # create these base builds always on the smallest system possible
45     rs.flavor = 'general1-1'
46
47     # allow for switching to ORD cloud but default to DFW
48     if (ENV['RSREGION'] == 'ord')
49       rs.rackspace_region = :ord
50     else
51       rs.rackspace_region = :dfw
52     end
53
54     # Default to the Fedora 20 image unless overridden by a RSIMAGE
55     # environment variable
56     if ENV['RSIMAGE']
57       rs.image = ENV['RSIMAGE']
58     else
59       rs.image = 'Fedora 20 (Heisenbug) (PVHVM)'
60     end
61   end
62
63   # Do a full system update and force enforcing on (it's in permissive
64   # by default in the rackspace base images)
65   config.vm.provision 'shell', path: 'bootstrap.sh'
66
67   # disable the default requiretty for sudo that Fedora and CentOS have
68   config.vm.provision 'shell', path: 'remove_requiretty.sh'
69
70   # Execute a system clean-up in prep for imaging so that this base
71   # image can be used for other Rackspace Vagrant configurations
72   config.vm.provision 'shell', path: 'system_reseal.sh'
73 end