Tuesday, May 12, 2015

There are no strings on me!

Lets start with puppet.
I think I made a mistake and made it too complicated out of the gate. I did some bad things in my configs, like set environments for different things.
So lets review a basic puppetmaster config with environments.
It is in the standard /etc/puppet/puppet.conf location

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
environmentpath = $confdir/environments
basemodulepath = $confdir/modules
dns_alt_names = puppet,puppet.velcrohurts.com,puppet.velcrohurts.local
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post

server = puppet.velcrohurts.com
runinterval = 300

[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN 
ssl_client_verify_header = SSL_CLIENT_VERIFY

So that little bit tells us we want to use environments in /etc/puppet/environments/
inside that directory we have


stephen.mcgroarty@nostrings:~$ ls /etc/puppet/environments/
development  example_env  production  staging

I think the labels are self explanatory here, but you can add a folder for whatever environment you want.
I recommend usign the environment =  tag on the clients.
I actually have a puppet manifest for the client side, so that when I put them in it stays there.

For the client, I have this manifest under /etc/puppet/environments/staging/modules/puppet/manifests/init.pp


class puppet {

    file { '/etc/puppet/puppet.conf':
        ensure => file,
        mode   => '644',
        owner  => 'root',
        group  => 'root',
        source => 'puppet:///modules/puppet/puppet.conf.erb'
    }
}


Then for the modules/puppet/files/puppet.conf.erb I have the puppet config.

## Managed by Puppet ## 

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter


server = puppet.velcrohurts.local
environment = staging
runinterval = 500

I change the environment = based on what location I want, and using puppet to control the puppet.conf might seem a bit odd, but it never changes on a single server for very long.

Friday, May 8, 2015

Quick and Dirty

Let  me make this a quick and dirty one because I just want to post something slightly useful. So no re-write, no review, the errors stay for the most part.

Here is a git command line shortcut that I use almost daily, and it has been really easy to use from the command prompt, it is an alias for lol


[alias]
        lol = log --graph --decorate --pretty=oneline --abbrev-commit
        lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

Once you have it in your /home/username/.gitconfig you can do the cool thing of laughing out loud at git, and some people do, but I dont enjoy typing lol

The output looks all nice and happy

git lol

vs 
git log 



The choice is yours, but I like pretty colors and shorter blocks.