System admin puppet project

public

 

General Notes

  • I'm using vagrant to test my puppet system. Vagrant will set up three virtual machines:
1.  A puppet master: puppet.example.com

2.  A raspberry pi-type machine: engepi.example.com

3.  A compute-type machine: engecompute.example.com
  • Puppet runs on the master and makes sure the two clients follow the rules.

  • This is all git-tracked

  • The "provision" directory is used by vagrant to set up the initial virtual machines. Any puppet development should be kept out of there.

  • All devlopment should happen in the modules directory.

  • The nodes.pp file is the main puppet definition file.

  • See https://github.com/elasticdog/puppet-sandbox for this

Packages required

  • virtualbox

  • vagrant

Installing

Vagrant usage basics

Vagrant is used to easily manage a bunch of virtual machines (VMs). Good instructions can be found Elsewhere. A good video can be found here. But here is a short list of nice commands

  • Go into your project development directory:

    cd vagrant-test
    
  • Make a vagrant file (if there isn't one there already)

    vagrant init hashicorp/precise32
    

    or, if there is a .box file laying around

    vagrant box add centos64-x86_64-minimal centos64-x86_64-minimal.box
    
  • Make a virtual machine and boot it

    vagrant up
    
  • Check the status of VM

    vagrant status
    
  • Log into VM

    vagrant ssh
    

    If there are multiple VMs, specify the one you want

    vagrant ssh server1
    
  • Shut down (but don't destroy) the VM

    vagrant halt
    
  • destroy the virtual machine

    vagrant destory
    
  • reload the machines after messing with the Vagrantfile

    vagrant reload
    

Vagrant and EngeDev

In this case, the vagrant up command will make the three VMs described above. Some more details (again from https://github.com/elasticdog/puppet-sandbox).

  • Vagrant will make:
1.  The puppet server, puppet.example.com and install `puppetmaster` on it

2.  The puppet clients, engepi and engecompute and install `puppet`

3.  A network between the three machines (in the `/etc/hosts` files)

4.  Set up all the client signing so that they can talk to the master

5.  Set up the puppet server to use `nodes.pp` and the `modules`
    directory for its puppet configuration.
  • Things could get a little confusing. Vagrant uses a separate set of puppet things to set up the original VMs. They're all in the provision directory and don't have anything to do with the final sandbox. Mostly, you can leave this alone unless you're changing host names or wanting to make more clients, etc.

  • You can check things installed properly by logging into each system separately:

    vagrant ssh engepi
    
  • To test

    sudo puppet agent --test
    

Puppet modules

This is where we put all of the individual modules that puppet will watch on each computer. A desired list can be found in the TODO.org file.

Making my own packages

See https://github.com/jordansissel/fpm

Here's an example for geant4

  • Download and install geant4 completely

  • Make a deb package

    cd ~/
    fpm -s dir -t deb -n geant4 -v 10.01.p02 /opt/geant4/geant4.10.01.p02-install
    
  • Copy the debian file over to the server

    rsync -av geant4_10.01.p02_amd64.deb engesrv:
    
  • Now from the server, put this in our repository

    sudo su -
    cd /var/www/debs
    mv /home/longland/geant4_10.01.p02_amd64.deb amd64
    
  • Update the repository's package list

    dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz
    
  • Log out. We can now install these packages from the repos defined in the repos module!

Deploying!

Once we're happy with the VM development, we can deploy this whole thing. I don't know how to do this exactly, other than to copy files around. However, here are some resources to get started with: