Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Commit

Permalink
Updated to use new funtoo-oddb box and vagrant 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Jun 17, 2013
1 parent 1be13be commit 3d4f62a
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 112 deletions.
4 changes: 3 additions & 1 deletion Gemfile
@@ -1,6 +1,8 @@
source "http://rubygems.org"
ruby '1.9.3'
gem "vagrant", github: "mitchellh/vagrant", tag: "v1.1.5"
# gem "vagrant", github: "mitchellh/vagrant", tag: "v1.1.5"
# gem "vagrant", path: "/opt/src/vagrant"
gem "vagrant", github: "ngiger/vagrant"

# See https://github.com/rodjek/librarian-puppet/pull/87
# Until this commit is available via a version > 0.9.8 we need to use the git repo
Expand Down
100 changes: 27 additions & 73 deletions Gemfile.lock
@@ -1,88 +1,42 @@
GIT
remote: git://github.com/ngiger/vagrant.git
revision: fe7dbebc56d41c338ae2b77ad7fbb22ff50e91c8
specs:
vagrant (1.2.3.dev)
childprocess (~> 0.3.7)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
json (>= 1.5.1, < 1.8.0)
log4r (~> 1.1.9)
net-scp (~> 1.1.0)
net-ssh (~> 2.6.6)

GIT
remote: git://github.com/rodjek/librarian-puppet.git
revision: b707b1e609a1806e09fdce0a9d5c872a16ba1e20
specs:
librarian-puppet (0.9.9)
json
thor (~> 0.15)

GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
commonwatir (4.0.0)
data_magic (0.14)
faker (>= 1.1.2)
yml_reader (>= 0.2)
diff-lcs (1.2.2)
erubis (2.7.0)
facter (1.6.18)
faker (1.1.2)
i18n (~> 0.5)
ffi (1.6.0)
hiera (1.1.2)
json_pure
ffi (1.9.0)
i18n (0.6.4)
json (1.7.7)
json_pure (1.7.7)
librarian-puppet (0.9.8)
json
thor (~> 0.15)
log4r (1.1.10)
metaclass (0.0.1)
mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.7.2)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.2.2)
page-object (0.8.7)
page_navigation (>= 0.7)
selenium-webdriver (>= 2.31.0)
watir-webdriver (>= 0.6.2)
page_navigation (0.7)
data_magic (>= 0.14)
puppet (3.1.1)
facter (~> 1.6)
hiera (~> 1.0)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rspec-puppet (0.1.6)
rspec
rubyzip (0.9.9)
selenium-webdriver (2.31.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
net-scp (1.1.1)
net-ssh (>= 2.6.5)
net-ssh (2.6.7)
thor (0.18.1)
vagrant (1.0.7)
archive-tar-minitar (= 0.5.2)
childprocess (~> 0.3.1)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
json (>= 1.5.1, < 1.8.0)
log4r (~> 1.1.9)
net-scp (~> 1.0.4)
net-ssh (~> 2.2.2)
vagrant-hiera (0.4.0)
watir (4.0.2)
commonwatir (~> 4)
watir-webdriver
watir-webdriver (0.6.2)
selenium-webdriver (>= 2.18.0)
websocket (1.0.7)
yml_reader (0.2)

PLATFORMS
ruby

DEPENDENCIES
librarian-puppet
mocha
page-object
puppet
rspec-puppet
vagrant
vagrant-hiera
watir
librarian-puppet!
vagrant!
92 changes: 57 additions & 35 deletions Vagrantfile
@@ -1,53 +1,75 @@
# see http://vagrantup.com
# Copyright (c) Niklaus Giger, <niklaus.giger@member.fsf.org>
# License: GPLv2
# Boxes are stored under ~/.vagrant.d/boxes/

boxUrl = 'http://ngiger.dyndns.org/downloads/funtoo-oddb.box'
boxName = 'funtoo-oddb'
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'

#------------------------------------------------------------------------------------------------------------
# Some simple customization below
#------------------------------------------------------------------------------------------------------------
funtooName = 'funtoo-oddb-20130617'
privateFuntoo = "/opt/src/veewee-ngiger/funtoo-oddb-20130617.box"
funtooBox = File.exists?(privateFuntoo) ? privateFuntoo : "http://ngiger.dyndns.org/downloads/#{funtooName}.box"

debianName = 'Elexis-Wheezy-amd64-20130510'
privateDebian = "/opt/src/veewee-elexis/#{debianName}.box"
debianBox = File.exists?(privateDebian) ? privateDebian : "http://ngiger.dyndns.org/downloads/#{debianName}.box"


bridgedNetworkAdapter = "eth0" # adapt it to your liking, e.g. on MacOSX it might
# bridgedNetworkAdapter = "en0: Wi-Fi (AirPort)" # adapt it to your liking, e.g. on MacOSX it might
hieraCfg = YAML.load(File.open( 'hieradata/private/config.yaml' ) )

Vagrant::Config.run do |config|
# Setup the box
config.vm.box = boxName
config.vm.box_url = boxUrl if defined?(boxUrl)

# Boot with a GUI so you can see the screen. (Default is headless)
config.vm.boot_mode = :gui
config.vm.provision :puppet, :options => "--debug"


#------------------------------------------------------------------------------------------------------------
# End of simple customization
#------------------------------------------------------------------------------------------------------------
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# A good solution would be http://oddbfault.com/questions/418422/public-static-ip-for-vagrant-boxes

Vagrant.configure("2") do |config|

config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 6200, "--cpus", 2, ]
vb.gui = true
end

# This shell provisioner installs librarian-puppet and runs it to install
# puppet modules. This has to be done before the puppet provisioning so that
# the modules are available when puppet tries to parse its manifests.
config.vm.provision :shell, :path => "shell/main.sh"

config.vm.provision :puppet do |puppet|
# Now run the puppet provisioner. Note that the modules directory is entirely
# managed by librarian-puppet
puppet.options = '--debug'
puppet.manifests_path = "manifests"
puppet.manifest_file = "site.pp"
puppet.module_path = "modules"
end

if false
# I cannot use the following three lines as specified by https://github.com/gposton/vagrant-hieradata
# because this lead to trying to install apt usinge puppetlabs repository
# config.hiera.config_path = File.join(Dir.pwd, 'hieradata')
# config.hiera.config_file = 'hiera.yaml'
# config.hiera.data_path = File.join(Dir.pwd, 'hieradata')
else # use my workaround
config.vm.share_folder "hieradata", "/etc/puppet/hieradata", File.join(Dir.pwd, 'hieradata')
end

config.vm.define :oddbFuntoo do |oddbFuntoo|
oddbFuntoo.vm.box = funtooName
oddbFuntoo.vm.box_url = funtooBox
oddbFuntoo.vm.provider :virtualbox do |vb| vb.name = "oddb_funtoo" end
puts "Using funtooBox #{funtooBox}"
oddbFuntoo.vm.hostname = "oddb.#{`hostname -d`.chomp}"

# cannot specify an ip. Only works with the default of 10.0.2.15 of vagrant
# config.vm.network :hostonly, hieraCfg['::oddb_org::ip']
config.vm.host_name = hieraCfg['::oddb_org::hostname']
portBase ||= hieraCfg['::vagrant::portBase']
portBase ||= 44000
config.vm.forward_port 22, portBase + 22 # ssh
config.vm.forward_port 80, portBase + 80 # apache
config.vm.forward_port 81, portBase + 81 # shoe project
portBase ||= hieraCfg['::vagrant::portBase']
portBase ||= 44000
oddbFuntoo.vm.network :private_network, ip: "192.168.50.#{portBase/1000}"
oddbFuntoo.vm.network :forwarded_port, guest: 22, host: portBase + 22 # ssh
oddbFuntoo.vm.network :forwarded_port, guest: 80, host: portBase + 80 # apache
if false
# I cannot use the following three lines as specified by https://github.com/gposton/vagrant-hieradata
# because this lead to trying to install apt usinge puppetlabs repository
# config.hiera.config_path = File.join(Dir.pwd, 'hieradata')
# config.hiera.config_file = 'hiera.yaml'
# config.hiera.data_path = File.join(Dir.pwd, 'hieradata')
else # use my workaround
# config.vm.synced_folder "src/", "/srv/website"
config.vm.synced_folder "/etc/puppet/hieradata", File.join(File.dirname(__FILE__), 'hieradata') , disabled: true
end
end

end
10 changes: 7 additions & 3 deletions shell/main.sh
Expand Up @@ -26,9 +26,13 @@ emerge --sync && etc-update --automode -5
# Initialize /etc/puppet/hiera.yaml
df -h | grep hieradata
if [ $? -eq 0 ] ; then
export HIERA_DATA=/`df -h | grep hieradata | cut -d / -f 2-`
if [ ! -L /etc/puppet/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/puppet/hiera.yaml; fi
if [ ! -L /etc/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/hiera.yaml; fi
# export HIERA_DATA=/`df -h | grep hieradata | cut -d / -f 2-`
if [ ! -f /etc/puppet/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/puppet/hiera.yaml; fi
if [ ! -f /etc/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/hiera.yaml; fi
else
export HIERA_DATA=/vagrant/hieradata
if [ ! -f /etc/puppet/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/puppet/hiera.yaml; fi
if [ ! -f /etc/hiera.yaml ] ; then ln -s $HIERA_DATA/hiera.yaml /etc/hiera.yaml; fi
fi

# eix and ruby-augeas must also be installed before running puppet
Expand Down

0 comments on commit 3d4f62a

Please sign in to comment.