Tuesday, November 20, 2012

Getting Puppet master and agent running on a single Vagrant box

Ensure you have "lucid32" box:

vagrant box add lucid32 http://files.vagrantup.com/lucid32.box

Add a Vagrantfile in a new directory:

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

Vagrant::Config.run do |config|
  config.vm.box = "lucid32"

vagrant up

ssh into new vagrant box (port 2222)

sudo su -
echo -e "deb http://apt.puppetlabs.com/ lucid main\ndeb-src http://apt.puppetlabs.com/ lucid main" >> /etc/apt/sources.list.d/puppet.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 4BD6EC30
apt-get update
apt-get install puppet puppetmaster
apt-cache policy puppet
puppet --version
vi /etc/hosts

      # add      puppet.example.com    puppet
vi /etc/puppet/puppet.conf

     # add to [master] section: certname=puppet.example.com
touch /etc/puppet/manifests/site.ppiptables -A INPUT -p tcp -m state --state NEW --dport 8140 -j ACCEPT
puppet master --no-daemonize --verbose --debug

Start another ssh session to same box
sudo su -
puppet agent --verbose --debug