How I use Puppet at work

These are my notes for a presentation at my university on how I am using Puppet at work.
Read more of this post

Puppet module for /etc/fstab mounts

Puppet has a native module for handling fstab mounts. Here is an example:

class data_mounted {
    mount { "/data":
        device  => "/dev/sdb1",
        fstype  => "ext4",
	ensure  => "mounted",
	options => "defaults",
        atboot  => "true",

The “device” directive can take anything what you’d normally put in the first column of /etc/fstab, i.e. if you are mounting by label (which is probably the best way to mount partitions) then instead of “/dev/sdb1” call for “LABEL=data”, where ls -l /dev/disk/by-label/data should point to the actual [and existing] partition, which in my case is /dev/sdb1.

The “fstype” is the actual type of the partition, if you are not sure of the type you can check it with df -T. You can mount linux ext partitions, nfs, samba, 9p etc.

For more on fstab file system types and mount options check

Puppet: User Management and /home over NFS

I was looking for a way to automate user configuration management on 20 Linux machines that I have been administering for several months now. In my setup I want to see following:

  • add a user once, have him/her on as many machines as you define
  • share users’ home directories over the network

There are many ways to have it done. I wanted to see how this can be achieved with Puppet for several reasons, mainly, because I want to have as much config management under the same hood as possible. And I am just starting with Puppet, so comments are welcome.

To implement the user management setup I need three modules:

  • users – will define users, their passwords, ssh-keys (optional), default shells etc
  • nfs_server – will share /home directory over NFS
  • nfs_client – will mount the shared /home directory as /home

In this demo I have three machines, all running Debian Squeeze:

  • – is the puppet master
  • – NFS server, will share /home over the network
  • – NFS client, will mount /home from node1

Read more of this post