Skip to content

Commit

Permalink
use unique certnames, config puppet agent first
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Apr 3, 2013
1 parent 40c723f commit 95968a6
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 137 deletions.
57 changes: 44 additions & 13 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ Vagrant.configure("2") do |config|
# 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.
# Wooden ships on the water. Very free. And Easy.

# Every Vagrant virtual environment requires a box to build off of.
# Use multi VM syntax
config.vm.define :kalabox do |kalabox|
kalabox.vm.box = "kalabox"
kalabox.vm.hostname = "kalabox"
kalabox.vm.hostname = "kala"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
Expand Down Expand Up @@ -39,8 +40,8 @@ Vagrant.configure("2") do |config|

# Set some SSH config
# config.ssh.username = "kala"
kalabox.ssh.host = "kalabox"
kalabox.ssh.forward_agent = true
# kalabox.ssh.host = "kalabox"
# kalabox.ssh.forward_agent = true

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
Expand Down Expand Up @@ -77,26 +78,56 @@ Vagrant.configure("2") do |config|
# # Managed by Puppet.\n"
# # }
#
kalabox.vm.provision :puppet_server do |puppet_server|
puppet_server.puppet_server = "kalabox.kalamuna.com"
puppet_server.options = "--verbose --debug --test --environment dev"
puppet_server.facter = {

$script = "
if [ ! -f /etc/kalabox/uuid ]; then
mkdir /etc/kalabox
uuidgen > /etc/kalabox/uuid
export KALAUUID=$(cat /etc/kalabox/uuid)
apt-get update -y
apt-get install puppet -y
if grep --quiet certname /etc/puppet/puppet.conf; then
echo
else
echo '[agent]' >> /etc/puppet/puppet.conf
echo 'classfile = $vardir/classes.txt' >> /etc/puppet/puppet.conf
echo 'localconfig = $vardir/localconfig' >> /etc/puppet/puppet.conf
echo 'report = true' >> /etc/puppet/puppet.conf
echo 'pluginsync = true' >> /etc/puppet/puppet.conf
echo 'masterport = 8140' >> /etc/puppet/puppet.conf
echo 'environment = production' >> /etc/puppet/puppet.conf
echo 'server = kalabox.kalamuna.com' >> /etc/puppet/puppet.conf
echo 'node_name = facter' >> /etc/puppet/puppet.conf
echo 'listen = false' >> /etc/puppet/puppet.conf
echo 'certname = kala.'$KALAUUID'.f04083c46d392c7c7276a3570a96d095.box' >> /etc/puppet/puppet.conf
service puppet restart -y
fi
fi
"

kalabox.vm.provision :shell, :inline => $script
kalabox.vm.provision :puppet_server do |kalabox|
kalabox.puppet_server = "kalabox.kalamuna.com"
kalabox.options = "--verbose --debug --test"
kalabox.facter = {
"vagrant" => "1",
"kalauser" => "vagrant",
"kalahost" => "192.168.42.1",
}
end
kalabox.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "site.pp"
puppet.module_path = "modules"
puppet.options = "--verbose --debug"
puppet.facter = {
# should not ever run this provisioner except for development
kalabox.vm.provision :puppet do |start|
start.manifests_path = "manifests"
start.manifest_file = "site.pp"
start.module_path = "modules"
start.options = "--verbose --debug"
start.facter = {
"vagrant" => "1",
"kalauser" => "vagrant",
"kalahost" => "192.168.42.1",
}
end


# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
Expand Down
2 changes: 0 additions & 2 deletions manifests/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

node "default" {
# initialize core packages
include update
include puppet
include git
include unzip
include nfs
Expand Down
15 changes: 0 additions & 15 deletions modules/nfs/manifests/config.pp

This file was deleted.

13 changes: 0 additions & 13 deletions modules/nfs/manifests/service.pp

This file was deleted.

17 changes: 0 additions & 17 deletions modules/puppet/manifests/config.pp

This file was deleted.

8 changes: 0 additions & 8 deletions modules/puppet/manifests/init.pp

This file was deleted.

12 changes: 0 additions & 12 deletions modules/puppet/manifests/install.pp

This file was deleted.

14 changes: 0 additions & 14 deletions modules/puppet/manifests/service.pp

This file was deleted.

19 changes: 0 additions & 19 deletions modules/puppet/templates/puppet.conf.erb

This file was deleted.

10 changes: 0 additions & 10 deletions modules/update/manifests/init.pp

This file was deleted.

14 changes: 0 additions & 14 deletions modules/update/manifests/install.pp

This file was deleted.

7 changes: 7 additions & 0 deletions modules/uuid/lib/facter/kalauuid.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# kalauuid.rb

Facter.add("kalauuid") do
setcode do
Facter::Util::Resolution.exec("cat /etc/kalabox/uuid").chomp
end
end

0 comments on commit 95968a6

Please sign in to comment.