wiki:how-to/puppet/dev-env

Version 10 (modified by Daniel Kahn Gillmor, 6 years ago) (diff)

--

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.

Hopefully, 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 Virtual Machine

Be sure you have at least 2GB of space available on your disk and the qemu-kvm package installed.

The Debian Wiki has useful directions for installing Debian on a KVM image. Or, to get going even faster, you can download pre-build Debian stable images.

You can start your virtual image with:

screen kvm -drive file=images/roach.qcow,if=virtio,id=hda,boot=on -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.

Networking

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
git config remote.roach.skipDefaultUpdate true

Next, push into roach:

git push roach master