<?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>yo61.com &#187; puppet</title>
	<atom:link href="http://yo61.com/tag/puppet/feed" rel="self" type="application/rss+xml" />
	<link>http://yo61.com</link>
	<description>Open Source System Deployment &#38; Administration in the wilds of North Yorkshire</description>
	<lastBuildDate>Mon, 01 Mar 2010 23:45:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Writing puppet manifests that can remove resources as well as adding them</title>
		<link>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html</link>
		<comments>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html#comments</comments>
		<pubDate>Fri, 29 Jan 2010 17:07:24 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=123</guid>
		<description><![CDATA[I use puppet to manage the configuration of the machines I manage. So far, I&#39;ve been rolling out new resources to machines but recently I&#39;ve wanted to remove resources from machines. Here&#39;s how I modified my cron classes so I could remove cron jobs as well as create them.
When I first wrote my cron classes, [...]]]></description>
			<content:encoded><![CDATA[<p>I use puppet to manage the configuration of the machines I manage. So far, I&#39;ve been rolling out new resources to machines but recently I&#39;ve wanted to remove resources from machines. Here&#39;s how I modified my cron classes so I could remove cron jobs as well as create them.</p>
<p><span id="more-123"></span>When I first wrote my cron classes, I created a separate class for each cron job, eg.</p>
<pre>class app::queue_processor::cron::cacheload {

    include
        user::base

    cron { cacheload:
        command =&gt; &#39;/usr/bin/php /app/queue_processor/utils/cacheload.php account &gt; /dev/null 2&gt;&amp;1&#39;,
        hour    =&gt; &#39;0&#39;,
        minute  =&gt; &#39;0&#39;,
        user    =&gt; &#39;app&#39;,
        require =&gt; User[&#39;app&#39;]
    }

}
</pre>
<p>I then created another class for each profile which includes all the required cron jobs, eg:</p>
<pre>class profile::partition::cron {
    include
        app::queue_processor::cron::cacheload
        app::queue_processor::cron::send_move_backlog
}</pre>
<p>This all works fine and the cron jobs are installed as required. However, I recently needed to remove the <code>cacheload</code> cron job from all machines.</p>
<p>This is simply a matter of specifying &quot;ensure =&gt; absent&quot; to the cron type. I therefore needed some way of passing this to the cron job classes.</p>
<p>I did this by creating a higher-level cron class, <code>app::queue_processor::cron</code> containing a definition <code>app::queue_processor::cron::job</code> which takes an <code>ensure</code> parameter that defaults to &quot;<code>present</code>&quot; if not specified. It looks like this:</p>
<pre>class app::queue_processor::cron {}
define app::queue_processor::cron::job($ensure = present) {

    include user::base

    case $name {
        cacheload: {
            cron { $name:
                command =&gt; &#39;/usr/bin/php /app/queue_processor/utils/cacheload.php account &gt; /dev/null 2&gt;&amp;1&#39;,
                hour    =&gt; &#39;0&#39;,
                minute  =&gt; &#39;0&#39;,
                user    =&gt; &#39;app&#39;,
                require =&gt; User[&#39;app&#39;]
                ensure  =&gt; $ensure
            }
        }

        send_move_backlog: {
            cron { $name:
                # similar cron definition here
            }
        }

        default: { fail(&quot;Unknown queue_processor cron job type: $name&quot;) }
    }
}
</pre>
<p>I use this new define in the <code>profile::partition::cron</code> class like this:</p>
<pre>class profile::partition::cron {
    include app::queue_processor::cron
    app::queue_processor::cron::job{ send_move_backlog: }
    app::queue_processor::cron::job{ cacheload: ensure =&gt; absent }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pre-generate sshd certificates</title>
		<link>http://yo61.com/pre-generate-sshd-certificates.html</link>
		<comments>http://yo61.com/pre-generate-sshd-certificates.html#comments</comments>
		<pubDate>Wed, 11 Nov 2009 10:27:31 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sshd]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=83</guid>
		<description><![CDATA[I use puppet to distribute my sshd configuration, including pre-generated ssh certificates.
Here&#39;s how I bulk create certificates for a bunch of new nodes named b001-b034:

for n in $&#40;seq -w 1 34&#41;; do
    ssh-keygen -q -t rsa -f b0$n -C '' -N ''
done

]]></description>
			<content:encoded><![CDATA[<p>I use puppet to distribute my sshd configuration, including pre-generated ssh certificates.</p>
<p>Here&#39;s how I bulk create certificates for a bunch of new nodes named b001-b034:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> n <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">1</span> <span style="color: #000000;">34</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-t</span> rsa <span style="color: #660033;">-f</span> b0<span style="color: #007800;">$n</span> <span style="color: #660033;">-C</span> <span style="color: #ff0000;">''</span> <span style="color: #660033;">-N</span> <span style="color: #ff0000;">''</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://yo61.com/pre-generate-sshd-certificates.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
