| | 1 | [PageOutline] |
| | 2 | = Setting up a puppet development environment = |
| | 3 | |
| | 4 | == Pain test == |
| | 5 | Before you begin, check to see if your CPU supports virtualization: |
| | 6 | |
| | 7 | {{{ |
| | 8 | egrep '(vmx|svm)' /proc/cpuinfo |
| | 9 | }}} |
| | 10 | |
| | 11 | If that commands returns nothing, you are in for a painful ride. Development will be really slow and possibly not worth it. |
| | 12 | |
| | 13 | Hopefull, you will instead see something like: |
| | 14 | |
| | 15 | {{{ |
| | 16 | 0 jamie@chicken:puppet$ egrep '(vmx|svm)' /proc/cpuinfo |
| | 17 | 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 |
| | 18 | 0 jamie@chicken:puppet$ |
| | 19 | }}} |
| | 20 | |
| | 21 | == Setting up your directory structure == |
| | 22 | |
| | 23 | Be sure you have at least 2GB of space available on your disk. |
| | 24 | |
| | 25 | Here's a sample directory layout: |
| | 26 | |
| | 27 | * confdir - put the MFPL git repo here (e.g. `git clone gitosis@git.mayfirst.org/mfpl/puppet confdir`) |
| | 28 | |
| | 29 | * 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. |
| | 30 | |
| | 31 | * modules - this is where I git checkout puppet modules from other puppet developers before adding them to our repository. |
| | 32 | |
| | 33 | == Launching your virtual image |
| | 34 | |
| | 35 | Be sure you have the qemu-kvm package installed. |
| | 36 | |
| | 37 | You can start your virtual image with: |
| | 38 | |
| | 39 | {{{ |
| | 40 | screen kvm -hda images/roach.qcow -m 512 -net nic -net user,hostfwd=tcp::2222-:22 -nographic |
| | 41 | }}} |
| | 42 | |
| | 43 | 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. |
| | 44 | |
| | 45 | You can login with root (no password). |
| | 46 | |
| | 47 | After logging in, set the root password by typing: |
| | 48 | |
| | 49 | {{{ |
| | 50 | passwd |
| | 51 | }}} |
| | 52 | |
| | 53 | Then, you can exit and detach from the screen session. |
| | 54 | |
| | 55 | The kvm command sets up very simple networking, with port 2222 on our localhost forwarded to port 22 on roach. |
| | 56 | |
| | 57 | Add the following to your ~/.ssh/config file: |
| | 58 | |
| | 59 | {{{ |
| | 60 | Host roach |
| | 61 | Hostname localhost |
| | 62 | Port 2222 |
| | 63 | User root |
| | 64 | }}} |
| | 65 | |
| | 66 | Now, you should be able to ssh into your host with: |
| | 67 | |
| | 68 | {{{ |
| | 69 | ssh root@roach |
| | 70 | }}} |
| | 71 | |
| | 72 | == Bootstrapping your puppet configuration == |
| | 73 | |
| | 74 | You are now ready for your first puppet push. |
| | 75 | |
| | 76 | Begin in your confdir. Add a remote for roach: |
| | 77 | |
| | 78 | {{{ |
| | 79 | git remote add roach root@roach:/etc/puppet-bare |
| | 80 | }}} |
| | 81 | |
| | 82 | Next, push into roach: |
| | 83 | |
| | 84 | {{{ |
| | 85 | git push roach master |
| | 86 | }}} |