[[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. 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 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 [/special/roach.qcow.gz roach.qcow.gz] 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. [0] {{{ cp roach.qcow.gz roach.qcow.bak.gz; gunzip roach.qcow.gz }}} * 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 -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. 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 }}} === Using a copy-on-write image === Alternately, one can create a copy-on-write image to save only the changes made when working with a "base" image. The syntax is: {{{ qemu-img create -b -f }}} For the roach image, this would be: {{{ qemu-img create -b images/roach.qcow -f qcow2 images/roach-changes.qcow2 }}} Then one would use "images/roach-changes.qcow2" as the value of the -hda parameter when starting the virtual image.