wiki:how-to/puppet/dev-env

Version 1 (modified by Jamie McClelland, 9 years ago) (diff)

--

[PageOutline]

Setting up a puppet development environment

Pain test

Before you begin, check to see if your CPU supports virtualization:

egrep '(vmx|svm)' /proc/cpuinfo

If that commands returns nothing, you are in for a painful ride. Development will be really slow and possibly not worth it.

Hopefull, you will instead see something like:

0 jamie@chicken:puppet$  egrep '(vmx|svm)' /proc/cpuinfo
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow up rep_good nopl extd_apicid pni cx16 lahf_lm svm extapic cr8_legacy 3dnowprefetch lbrv
0 jamie@chicken:puppet$

Setting up your directory structure

Be sure you have at least 2GB of space available on your disk.

Here's a sample directory layout:

  • confdir - put the MFPL git repo here (e.g. git clone gitosis@git.mayfirst.org/mfpl/puppet confdir)
  • images - download (link coming soon) into your images directory. Don't gunzip right away! Instead, make a backup copy (so you don't have to re-download it if you mess it up), then gunzip it.
  • modules - this is where I git checkout puppet modules from other puppet developers before adding them to our repository.

Launching your virtual image

Be sure you have the qemu-kvm package installed.

You can start your virtual image with:

screen kvm -hda images/roach.qcow -m 512 -net nic -net user,hostfwd=tcp::2222-:22 -nographic

This should put you into a screen session, allowing you to watch the boot process. You can detach with ctl-a d and re-attach with screen -x.

You can login with root (no password).

After logging in, set the root password by typing:

passwd

Then, you can exit and detach from the screen session.

The kvm command sets up very simple networking, with port 2222 on our localhost forwarded to port 22 on roach.

Add the following to your ~/.ssh/config file:

Host roach
Hostname localhost
Port 2222
User root

Now, you should be able to ssh into your host with:

ssh root@roach

Bootstrapping your puppet configuration

You are now ready for your first puppet push.

Begin in your confdir. Add a remote for roach:

git remote add roach root@roach:/etc/puppet-bare

Next, push into roach:

git push roach master