frank2.net

Puppet and Vagrant setup

Published by Frank Solli on

Puppet and Vagrant

Frank Solli

This one is pretty simple and gives a lot in return, When doing big changes (and minor ones, really) I can quickly see how the changes will affect production hosts.

Generate a new host certificate on the server or locally, sign it, and place it in puppet_ssl directory.

Place your config file, and type in vagrant –provision, voila.





# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.box = "precise64"
config.vm.hostname = "vagrant.frank.local"

config.vm.box_url = "http://files.vagrantup.com/precise64.box"

config.vm.synced_folder "./puppet_ssl", "/vagrant/puppet_ssl"

config.vm.provision "shell",
  inline: "
    mkdir -p /etc/puppet/ssl/certs;
    mkdir -p /etc/puppet/ssl/private_keys;
    cp /vagrant/puppet_ssl/certs/* /etc/puppet/ssl/certs;
    cp /vagrant/puppet_ssl/private_keys/* /etc/puppet/ssl/private_keys
    apt-get update
    apt-get -y install python-software-properties
    apt-add-repository -y ppa:brightbox/ruby-ng
    wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
    dpkg -i puppetlabs-release-precise.deb
    rm puppetlabs-release-precise.deb
    apt-get -qq update
    apt-get -y install ruby1.9.3 puppet libaugeas-ruby1.9.1"

config.vm.provision "puppet_server" do |puppet|
        puppet.puppet_server = "puppet.x.no"
        puppet.puppet_node = "vagrant.frank.local"
        puppet.options = "--no-daemonize --pluginsync --onetime --verbose --environment=refactor"

end
end


Tags: puppetvagrant.