convert to yaml configs

This commit is contained in:
Sean Dague 2014-03-03 10:09:17 -05:00
parent b3e958bc0b
commit 62a3a28612
4 changed files with 38 additions and 38 deletions

View File

@ -10,7 +10,7 @@ completely generically (puppet templates currently hate me under
vagrant).
This will build a vagrant cluster that is L2 bridged to the interface
that you specify in `` local_config.rb``. All devstack guests (2nd
that you specify in ``config.yaml``. All devstack guests (2nd
level) will also be L2 bridged to that network as well. That means
that once you bring up this environment you will be able to ssh
stack@api (or whatever your hostname is) from any machines on your
@ -41,7 +41,7 @@ the above is recommended size.
Local Setup
--------------------
Copy ``local_config.rb.sample`` to ``local_config.rb`` and provide the
Copy ``config.yaml.sample`` to ``config.yaml`` and provide the
hostnames you want, and password hash (not password), and sshkey for
the stack user.

40
Vagrantfile vendored
View File

@ -6,7 +6,8 @@ if not VAGRANTFILE_API_VERSION
VAGRANTFILE_API_VERSION = "2"
end
require './local_config.rb'
require 'yaml'
conf = YAML.load(File.open('config.yaml'))
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
@ -15,7 +16,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "manager" do |manager|
manager.vm.box = "devstack-api"
manager.vm.hostname = MANAGER_HOSTNAME
manager.vm.hostname = conf['manager_hostname']
manager.vm.provision "puppet" do |puppet|
puppet.manifests_path = "puppet/manifests"
@ -27,19 +28,19 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## tells default.pp that we're running in Vagrant
"is_vagrant" => true,
"is_compute" => false,
"stack_pass" => STACK_PASS,
"stack_sshkey" => STACK_SSHKEY
"stack_pass" => conf['stack_pass'],
"stack_sshkey" => conf['stack_sshkey']
}
if DEVSTACK_GIT
puppet.facter['devstack_git'] = DEVSTACK_GIT
puppet.facter['devstack_branch'] = DEVSTACK_BRANCH
if conf['devstack_git']
puppet.facter['devstack_git'] = conf['devstack_git']
puppet.facter['devstack_branch'] = conf['devstack_branch']
end
end
end
config.vm.define "compute1" do |compute1|
compute1.vm.box = "compute1"
compute1.vm.hostname = COMPUTE1_HOSTNAME
compute1.vm.hostname = conf['compute1_hostname']
compute1.vm.provision "puppet" do |puppet|
puppet.manifests_path = "puppet/manifests"
@ -51,17 +52,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## tells default.pp that we're running in Vagrant
"is_vagrant" => true,
"is_compute" => true,
"stack_pass" => STACK_PASS,
"stack_sshkey" => STACK_SSHKEY,
"manager_hostname" => MANAGER_HOSTNAME
"stack_pass" => conf['stack_pass'],
"stack_sshkey" => conf['stack_sshkey'],
"manager_hostname" => conf['manager_hostname']
}
if DEVSTACK_GIT
puppet.facter['devstack_git'] = DEVSTACK_GIT
puppet.facter['devstack_branch'] = DEVSTACK_BRANCH
if conf['devstack_git']
puppet.facter['devstack_git'] = conf['devstack_git']
puppet.facter['devstack_branch'] = conf['devstack_branch']
end
end
end
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
#
@ -72,8 +72,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_url = 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box'
# this lets you use a locally accessible version faster
if BOX_URL
config.vm.box_url = BOX_URL
if conf['box_url']
config.vm.box_url = conf['box_url']
end
# config.ssh.private_key_path = "/home/sdague/.ssh/id_rsa"
@ -90,7 +90,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network :public_network, :bridge => BRIDGE_INT
config.vm.network :public_network, :bridge => conf['bridge_int']
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
end
@ -104,8 +104,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
if LOCAL_OPENSTACK_TREE
config.vm.synced_folder LOCAL_OPENSTACK_TREE, "/home/vagrant/openstack"
if conf['local_openstack_tree']
config.vm.synced_folder conf['local_openstack_tree'], "/home/vagrant/openstack"
end
end

16
config.yaml.sample Normal file
View File

@ -0,0 +1,16 @@
manager_hostname: api.dague.pvt
compute1_hostname: compute1.dague.pvt
stack_pass: somebiglongLinuxpasswordhash
stack_sshkey: >
the_ssh_public_key_you_want_for_your_stack_user
# what interface on the host should be used for a bridge
# will often be eth0, but vagrant needs to know for sure
bridge_int: eth1
# A non upstream url for the base box, used to speed things up
#box_url: http://gallifrey/vagrant/devstack-2014-02-19.box
# Local devstack options
# a non upstream git url to fetch devstack from instead
#devstack_git: /home/vagrant/openstack/devstack
# if you have code on a different branch than master, you can set it here
#devstack_branch: compute_err_exit

View File

@ -1,16 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
MANAGER_HOSTNAME = 'api.dague.pvt'
COMPUTE1_HOSTNAME = 'compute1.dague.pvt'
STACK_PASS = 'somebiglongLinuxpasswordhash'
STACK_SSHKEY = 'the_ssh_public_key_you_want_for_your_stack_user'
BRIDGE_INT = 'eth1'
# if you have built a local box that works to boot with, you can use that
# instead
# BOX_URL = "http://gallifrey/vagrant/devstack-2014-02-19.box"
# if you want to add your local devstack tree into the environments, use
# this
# LOCAL_OPENSTACK_TREE = '/home/sdague/code/openstack'