<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ball Dawg! &#187; Puppet</title>
	<atom:link href="http://www.balldawg.net/index.php/tag/puppet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.balldawg.net</link>
	<description>Just some ninja monkeys, nothing to see here.  Move along.</description>
	<lastBuildDate>Fri, 13 Jan 2012 02:02:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using HAProxy and Keepalived for HA Puppet</title>
		<link>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/</link>
		<comments>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 19:30:43 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[HAProxy]]></category>
		<category><![CDATA[keepalived]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=359</guid>
		<description><![CDATA[I&#8217;ve had a &#8220;backup&#8221; puppet server for some time now, but the fail-over was completely manual. Meaning if the main puppet server failed, I&#8217;d actually need to change DNS to point to the other server. This if fine for environments where a bit of downtime does not hurt, but in a production environment it&#8217;s less [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a &#8220;backup&#8221; puppet server for some time now, but the fail-over was completely manual.  Meaning if the main puppet server failed, I&#8217;d actually need to change DNS to point to the other server.  This if fine for environments where a bit of downtime does not hurt, but in a production environment it&#8217;s less than ideal.   When I had a bit of spare time recently I decided to implement an automatic fail over for our environment.  To do this I decided to use HAProxy for the load balancing and keepalived to manage a virtual IP.<br />
<img alt="" src="http://www.balldawg.net/files/diagram_vip.png" title="Network Layout" class="aligncenter" width="628" height="203" /><br />
<span id="more-359"></span><br />
This setup assumes that when you setup your puppet master you didn&#8217;t use the actual machine name as the puppet server name in your puppet.conf.  For example, in my case I used puppet.domain.com, as apposed to the actual DNS name of the machine it lives on.  puppet.domain.com is just a CNAME to the machines DNS name, but since web based SSL is based off the DNS name you are connecting too I can float different machines behind puppet.domain.com and the client is none the wiser.  To do it you&#8217;ll need to sign puppet.machine.com with puppetca and mirror your CA to your backup machine.  </p>
<p>To make this setup work, first you&#8217;ll need a virtual IP to point puppet.machine.com at and setup keepalived to manage it.  The keepalived setup was fairly straight forward, both machines were on the same network so I just picked an IP and configured keepalived on each machine.  In my case the configurations were as follows:</p>
<pre class="brush: php">
vrrp_instance VI_1 {
        interface bond0
        state MASTER
        virtual_router_id 51
        priority 101
        authentication {
            auth_type PASS
            auth_pass PASSWORD
        }
        virtual_ipaddress {
                192.168.33.61/26 dev bond0
        }
        notify_master /sw/keepalived/scripts/notify_master.sh
        notify_backup /sw/keepalived/scripts/notify_backup.sh
        notify_fault /sw/keepalived/scripts/notify_backup.sh
}
</pre>
<p>Basically for bonded interface 0, add the virtual interface of 192.168.33.61/26, and this machine has a priority of 101, or master.  The three entries at the bottom are what to run if the machine should fail over or fail back.  The other machine has a similar setup, except it has the priority of 100, or backup.</p>
<p>After starting up keepalived on both machines, they negotiate and the machine with the higher priority ends up with the IP enabled on bond0 as a secondary address.</p>
<p>Next I needed something to manage fail-over of the puppet &#8220;service&#8221; should the interface/IP stay up and just the puppet service fail.  For this I decided to use HAProxy.  It&#8217;s configuration is, again, fairly straight forward.  You need to setup a front end to listen on the default puppet master port, and a back end that has both your puppet master machines in it.  The configuration is as follows:</p>
<pre class="brush: php">
global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     10000
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats

defaults
    log                     global
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 8000

frontend        puppet 192.168.33.61:8140
    mode tcp
    default_backend     puppet0

backend puppet0
    mode        tcp
    option      ssl-hello-chk
    balance     roundrobin
    server      server1 192.168.33.17:8140 check
    server      server2 192.168.33.27:8140 check backup
</pre>
<p>This configuration and the installation of haproxy is mirrored on the second server.  </p>
<p>Now if you recall I had some scripts that were to run should keepalived feel the need to fail to/from the backup server.  Because haproxy binds to the address on start up, you can&#8217;t have it running on your backup server.  To work around the script is run upon keepalived starting that IP on the system, the script starts haproxy.</p>
<p>With the complicated part done, it was just a matter of mirroring my puppet manifests and files between the two machines, and making sure they stay up to date.  Ideally you&#8217;d have them on some sort of NAS which is just mounted on both machines which would make them being out of date impossible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2010/12/haproxy-keepalived-puppet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Puppet Dashboard with Multiple Puppet Masters</title>
		<link>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/</link>
		<comments>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/#comments</comments>
		<pubDate>Wed, 26 May 2010 14:38:02 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=310</guid>
		<description><![CDATA[Mike Zupan&#8217;s blog has a nice how to on installing puppet&#8217;s dashboard on CentOS 5, following it I was able to get the dashboard up and running with ease.  Since I have two puppet master&#8217;s that I&#8217;d like to report to the dashboard I found you can easily accomplish this without a full dashboard install [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://zcentric.com/2010/03/11/install-puppet-dashboard-on-redhatcentos-5/">Mike Zupan&#8217;s blog</a> has a nice how to on installing puppet&#8217;s dashboard on CentOS 5, following it I was able to get the dashboard up and running with ease.   Since I have two puppet master&#8217;s that I&#8217;d like to report to the dashboard I found you can easily accomplish this without a full dashboard install on each master.</p>
<p>You just need to:</p>
<ol>
<li>Copy over &#8216;puppet_dashboard.rb&#8217; with a modified HOST line to the other host.</li>
<li>Modify /etc/sysconfig/puppetmaster.</li>
<li>Turn on reporting on the clients.</li>
<li>Restart puppetmaster.</li>
</ol>
<p>Since the puppet_dashboard.rb is just making an HTTP post to the dashboard server, it can be coming from anywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2010/05/puppet-dashboard-with-multiple-puppet-masters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple Puppet Recipe for Tripwire</title>
		<link>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/</link>
		<comments>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:43:40 +0000</pubDate>
		<dc:creator>Andrew Rankin</dc:creator>
				<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Server Monitoring]]></category>
		<category><![CDATA[Tripwire]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.balldawg.net/?p=262</guid>
		<description><![CDATA[Since I failed to find a good description of how to do this on the web, I thought I&#8217;d share my recipe for using puppet to manage tripwire. This method will take care of running the initialization on the first puppetd run on a new machine, and update the policy file if its changed. It [...]]]></description>
			<content:encoded><![CDATA[<p>Since I failed to find a good description of how to do this on the web, I thought I&#8217;d share my recipe for using puppet to manage tripwire.   This method will take care of running the initialization on the first puppetd run on a new machine, and update the policy file if its changed.  It also has puppet managing your site.key, twcfg.txt, twpol.txt, and the daily cron to run the checks.  Its an extremely simple setup, but gets the job done.</p>
<p>I&#8217;ll start with the tripwire.pp file for puppet, in this file you&#8217;ll define your tripwire class and associated files and packages:<br />
<span id="more-262"></span></p>
<pre class="brush: perl">
class tripwire {
        file { &quot;/etc/tripwire/Makefile&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/Makefile&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/site.key&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/site.key&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/twcfg.txt&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/twcfg.txt&quot;,
                require =&gt; Package[tripwire],
        }
        file { &quot;/etc/tripwire/twpol.txt&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
                source =&gt; &quot;puppet:///etc/tripwire/twpol.txt&quot;,
                require =&gt; Package[tripwire],
        }

        file { &quot;/etc/cron.daily/tripwire-check&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 755,
                source =&gt; &quot;puppet:///etc/cron.daily/tripwire-check&quot;,
                require =&gt; Package[tripwire],
        }

        file { &quot;/var/lib/tripwire/tripwire.twd&quot;:
                owner =&gt; root,
                group =&gt; root,
                mode =&gt; 440,
        }

        package {
                &quot;tripwire&quot;:
                        ensure =&gt; &quot;installed&quot;,
        }

        exec {
                &quot;make -C /etc/tripwire&quot;:
                        cwd =&gt; &quot;/etc/tripwire&quot;,
                        path =&gt; [&quot;/bin&quot;, &quot;/usr/bin&quot; ],
                        creates =&gt; &quot;/var/lib/tripwire/tripwire.twd&quot;,
                        timeout =&gt; 10000
        }

        exec {
                &quot;tripwire --update-policy -Z low --local-passphrase &#039;&#039; --site-passphrase &#039;&#039; --quiet /etc/tripwire/twpol.txt&quot;:
                        cwd =&gt; &quot;/etc/tripwire&quot;,
                        path =&gt; [&quot;/sbin&quot;, &quot;/usr/sbin&quot; ],
                        timeout =&gt; 10000,
                        refreshonly =&gt; &quot;true&quot;,
                        subscribe =&gt; File[&quot;/etc/tripwire/twpol.txt&quot;],

        }
}
</pre>
<p>You&#8217;ll notice there is a Makefile defined, this will make remote management much simpler, it contains some simple house keeping items.  I do not use all these within my puppet implementation, however:</p>
<pre class="brush: perl">
all: tw.cfg tw.pol /var/lib/tripwire/tripwire.twd

clean:
        /bin/rm -f /etc/tripwire/local.key /etc/tripwire/tw.cfg /etc/tripwire/tw.pol /var/lib/tripwire/tripwire.twd

init: clean /var/lib/tripwire/tripwire.twd

local.key:
        /usr/sbin/twadmin --generate-keys --local-keyfile local.key --local-passphrase &#039;&#039;

tw.cfg: site.key twcfg.txt
        /usr/sbin/twadmin --create-cfgfile --site-keyfile site.key --site-passphrase &#039;&#039; twcfg.txt

tw.pol: tw.cfg twpol.txt
        if [ -f tw.pol -a -f /var/lib/tripwire/tripwire.twd ]; \
        then /usr/sbin/tripwire --update-policy --local-passphrase &#039;&#039; --quiet --secure-mode low --site-passphrase &#039;&#039; twpol.txt; \
        else /usr/sbin/twadmin --create-polfile --site-passphrase &#039;&#039; twpol.txt; \
        fi

/var/lib/tripwire/tripwire.twd: local.key site.key
        /usr/sbin/tripwire --init --local-passphrase &#039;&#039;
</pre>
<p>My twcfg.txt is very simple:</p>
<pre class="brush: perl">
# required
DBFILE                 = /var/lib/tripwire/tripwire.twd
LOCALKEYFILE           = /etc/tripwire/local.key
POLFILE                = /etc/tripwire/tw.pol
REPORTFILE             = /var/lib/tripwire/report/$(DATE).twr
SITEKEYFILE            = /etc/tripwire/site.key

# e-mail notification
EMAILREPORTLEVEL       = 3
GLOBALEMAIL            = email@domain.tld
MAILMETHOD             = SENDMAIL
MAILNOVIOLATIONS       = false
MAILPROGRAM            = /usr/sbin/sendmail -oi -t

# other
EDITOR                 = /usr/bin/vim
LATEPROMPTING          = false
LOOSEDIRECTORYCHECKING = false
REPORTLEVEL            = 4
SYSLOGREPORTING        = true
TEMPDIRECTORY          = /var/tmp
</pre>
<p>Other than including the tripwire class within your site.pp file, thats about it.</p>
<p><em>Credit: The makefile was created by Steve Coile.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.balldawg.net/index.php/2009/08/puppetizing-tripwire/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

