<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Coding blog</title>
	<atom:link href="http://stuckinadoloop.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuckinadoloop.wordpress.com</link>
	<description>... or how I learned to be a sysadmin, slowly.</description>
	<lastBuildDate>Thu, 16 Feb 2012 18:19:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='stuckinadoloop.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Coding blog</title>
		<link>http://stuckinadoloop.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://stuckinadoloop.wordpress.com/osd.xml" title="Coding blog" />
	<atom:link rel='hub' href='http://stuckinadoloop.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Automated migration of systems to a new puppet master server</title>
		<link>http://stuckinadoloop.wordpress.com/2012/02/16/automated-migration-of-systems-to-a-new-puppet-master-server/</link>
		<comments>http://stuckinadoloop.wordpress.com/2012/02/16/automated-migration-of-systems-to-a-new-puppet-master-server/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 18:16:15 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Puppet]]></category>
		<category><![CDATA[Scientific Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=130</guid>
		<description><![CDATA[I recently built a new puppet master server and wanted to migrate all of my systems from the old master server to the new master server. Googling a bit shows various migration strategies, all of which are fairly horrible hacks, and didn&#8217;t quite do what I wanted. So I came up with my own horrible [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=130&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently built a new puppet master server and wanted to migrate all of my systems from the old master server to the new master server. Googling a bit shows various migration strategies, all of which are fairly horrible hacks, and didn&#8217;t quite do what I wanted. So I came up with my own horrible hack, in the form of a puppet module to do the work.</p>
<p>So here&#8217;s the recipe. I&#8217;ll refer to the old puppet server to which all systems are subscribed as oldserver, and the server to which I want to migrate the systems to as newserver. In my case oldserver had a DNS CNAME of puppet, and so puppet.conf on the client machines didn&#8217;t contain any &#8220;server=foo&#8221; lines. However, I think the recipe below is entirely general.</p>
<p>On oldserver I created a new modules containing the following (this was stored in /etc/puppet/modules/puppet/manifests/init.pp):</p>
<p><pre class="brush: bash;">
class puppet::migrate ( $puppetmaster ) {

  augeas {'puppet.conf.migrate':
    context =&gt; '/files/etc/puppet/puppet.conf/main',
    changes =&gt; [&quot;set server ${puppet::migrate::puppetmaster}&quot;,
		]
  }

  # These next two objects handle migration to a new puppet master
  # server - if the value of $puppetmaster is updated, the
  # puppet-clear-certs.sh script is executed.
  file {'/var/lib/puppet/lib/puppet-clear-certs.sh':
    owner  =&gt; 'root',
    group  =&gt; 'root',
    mode   =&gt; 700,
    source =&gt; 'puppet:///modules/puppet/puppet-clear-certs.sh',
  }

  exec {'/var/lib/puppet/lib/puppet-clear-certs.sh':
    path    =&gt; ['/usr/bin', '/bin', '/usr/sbin', '/sbin'],
    require =&gt; [File ['/var/lib/puppet/lib/puppet-clear-certs.sh'],
                Augeas ['puppet.conf.migrate'],
                ],
    unless  =&gt; [&quot;openssl x509 -text -in /var/lib/puppet/ssl/certs/ca.pem | grep ${puppet::migrate::puppetmaster} &gt;/dev/null 2&gt;&amp;1&quot;,
                &quot;openssl x509 -text -in /var/lib/puppet/ssl/certs/${fqdn}.pem | grep ${puppet::migrate::puppetmaster} &gt;/dev/null 2&gt;&amp;1&quot;,
                ]
  }
}
</pre><br />
The magic ingredient here is the file puppet-clear-certs.sh which was inspired by <a href="http://www.ryanuber.com/puppet-self-management.html" title="Ryan Uber's blog post">this blog post by Ryan Uber</a>. This script forks a shell on the client which waits until puppet has finished its catalogue run on the client and then deletes all the SSL certificates on the client, preparing the way for registration with the new server. This file looks like this:</p>
<p><pre class="brush: plain;">
#!/bin/bash

# This script is a hack to remove SSL certificates from a puppet
# client to prepare it for migration to a new puppet master server
# after puppet has altered the puppet.conf file to point to the new
# puppet master server.
#
# Normally, if you subscribe the puppet service to the puppet.conf
# file, the puppet service will be restarted too soon, interrupting
# the current puppet run. Various attempts at using
# configure_delayed_restart among other things have not proven to be
# 100% effective.  This script will watch the puppetdlock file, which
# can determine whether or not there is a run in progress. If there is
# a run in progress, we sleep for a second and then test again until
# the process is unlocked. Once unlocked, we can safely delete
# certificates and call a puppet restart. The checker process itself
# gets forked into the background. If it were not forked into the
# background, the puppet run would sit and wait for the process to
# return, or for the exec timeout, whichever came first. This would
# cause serious trouble if timeouts were disabled or very long periods
# of time.
#
# This script was inspired by this blog post by Ryan Uber:
# http://www.ryanuber.com/puppet-self-management.html
#


# Begin waiting for the current puppet run to finish, then restart.
/bin/sh -c &quot;
    until [ ! -f /var/lib/puppet/state/puppetdlock ]
    do
        sleep 1
    done
    /sbin/service puppet stop
    rm -f /var/lib/puppet/ssl/certs/*
    rm -f /var/lib/puppet/ssl/certificate_requests/*
    rm -r /var/lib/puppet/ssl/crl.pem
    /sbin/service puppet start
&quot; &amp;
 
# Always return true, since this script just forks another process.
exit 0
 
# EOF
</pre><br />
So, when this script is executed on the client after the puppet manifest delivered from oldserver modifies puppet.conf to point to newserver it waits until the puppet agent run finishes, then stops the puppet daemon, deletes all the SSL certs, and then restarts the puppet agent which will now connect to newserver and issue a certificate signing request.</p>
<p>So, having created that module, I rsync the puppet modules and manifests from oldserver onto newserver, and then edit the node entries on the oldserver to look like</p>
<p><pre class="brush: bash;">
node somenode.somewhere.com {
  class {'puppet::migrate':
    puppetmaster =&gt; 'newserver.somewhere.com',
  }
}
</pre></p>
<p>Well, in actual fact I added that class to the basenode from which all other nodes inherit, but you get the idea. Once this is active, nodes migrate and generate signing requests at the next puppet run, and you should see the signing requests on the newserver. Job done!</p>
<p>I should also point out the &#8220;unless&#8221; guards on the exec in the above init.pp file. Since I rsynced across the migration module, I wanted to protect myself from inadvertently re-triggering a migration from newserver to newserver on every puppet run, so those are there as a safeguard.<br />
&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=130&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2012/02/16/automated-migration-of-systems-to-a-new-puppet-master-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Multi-user use of virt-manager</title>
		<link>http://stuckinadoloop.wordpress.com/2012/02/13/multi-user-use-of-virt-manager/</link>
		<comments>http://stuckinadoloop.wordpress.com/2012/02/13/multi-user-use-of-virt-manager/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 14:12:13 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=112</guid>
		<description><![CDATA[Recently I wanted to deploy the libvirt/virt-manager/qemu-kvm virtualization stack on a bunch of Scientific Linux 6 workstations. This presented a number of requirements: Virtual machines need to be able to be installed and started by non-root users The workstations are multi-user, so we need to prevent users from running or modifying each other&#8217;s virtual machines [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=112&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I wanted to deploy the libvirt/virt-manager/qemu-kvm virtualization stack on a bunch of Scientific Linux 6 workstations. This presented a number of requirements:</p>
<ul>
<li>Virtual machines need to be able to be installed and started by non-root users</li>
<li>The workstations are multi-user, so we need to prevent users from running or modifying each other&#8217;s virtual machines</li>
<li>On these machines home directories are mounted over NFS, but we want the VM disk images located on a local scratch disk for performance</li>
<li>VMs will be considered to be scratch data &#8211; i.e. not backed up</li>
</ul>
<h1>Allowing non-root users to manage virtual machines</h1>
<p>Fortunately the libvirt stack has support for PolicyKit, and so allowing non-root users is simply a matter of setting some policy. Placing the following in the file <code>/etc/polkit-1/localauthority/50-local.d/50-virt.pkla</code> will allow all users to manage virtual machines:</p>
<p><pre class="brush: bash;">
[Allow all users libvirt management permissions but require password]
Identity=*
Action=org.libvirt.unix.manage
ResultAny=auth_self_keep
ResultInactive=auth_self_keep
ResultActive=auth_self_keep
</pre></p>
<p>With this file in place, a user starting virt-manager will be asked to enter their password (note: not root&#8217;s password), and can then proceed.</p>
<h1>Setting up per-user storage pools</h1>
<p>Now, at this point, the expectation made by libvirt/virt-manager is that virtual machine disk images are stored in /var/lib/libvirt/images, and indeed all users are able to create and manage virtual machines under this directory, as evidence by its permissions:</p>
<pre>
$ ls -ldZ /var/lib/libvirt/images
drwx--x--x. root root system_u:object_r:virt_image_t:s0 /var/lib/libvirt/images/
</pre>
<p>However, we want to have private storage pools for each user, and we don&#8217;t want to have them stored under /var, but rather on a locally mounted scratch disk (mounted at /scratch). We could proceed by requiring each user to create a storage pool using the virt-manager (via the Edit-&gt;Connection Details menu entry and chosing the Storage tab). However, unfortunately doing so as a non-root user results in the storage pool directory having the wrong permissions. For example, if I create a storage pool while running virt-manager as user jgu under /scratch/test:</p>
<pre>
$ ls -ldZ /scratch/temp/
drwx------. root root unconfined_u:object_r:root_t:s0 /scratch/temp/
</pre>
<p>which unfortunately won&#8217;t actually be usable by the user jgu. Similarly using virsh will have the same problem:</p>
<pre>
$ virsh --connect qemu:///system "pool-define-as jgu-vmstore  --type=dir --target=/scratch/virt/jgu/images ; pool-build jgu-vmstore ; pool-start jgu-vmstore ; pool-autostart jgu-vmstore"
...
$ ls -ldZ /scratch/virt/jgu/images
drwx------. root root unconfined_u:object_r:default_t:s0 /scratch/virt/jgu/images
</pre>
<p>I&#8217;ve reported this problem in the following bug reports:<br />
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=790038" title="Redhat Bugzilla #790038"> Redhat Bugzilla #790038</a><br />
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=790045" title="Redhat Bugzilla #790045"> Redhat Bugzilla #790045</a></p>
<p>Taking a look at the file /etc/libvirtd/storage/jgu-vmstore.xml that was created as a result of the virsh command above gives us a clue as to a solution to this problem:<br />
<pre class="brush: xml;">
&lt;pool type='dir'&gt;
  &lt;name&gt;jgu-vmstore2&lt;/name&gt;
  &lt;uuid&gt;6a81e62f-5c42-fc94-c32b-18877e025c31&lt;/uuid&gt;
  &lt;capacity&gt;0&lt;/capacity&gt;
  &lt;allocation&gt;0&lt;/allocation&gt;
  &lt;available&gt;0&lt;/available&gt;
  &lt;source&gt;
  &lt;/source&gt;
  &lt;target&gt;
    &lt;path&gt;/scratch/virt/jgu/images&lt;/path&gt;
    &lt;permissions&gt;
      &lt;mode&gt;0700&lt;/mode&gt;
      &lt;owner&gt;-1&lt;/owner&gt;
      &lt;group&gt;-1&lt;/group&gt;
    &lt;/permissions&gt;
  &lt;/target&gt;
&lt;/pool&gt;
</pre><br />
Notice the permissions block &#8211; so it seems possible to specify user and group during storage pool creation with virsh using the -pool-define switch together with an xml file desribing the storage pool. The bash script below does exactly this:<br />
<pre class="brush: bash;">
#!/bin/bash

usage=$(cat &lt;&lt;EOF
USEAGE:
$0 ROOTDIR STORAGE-POOL

ROOTDIR            directory under which to store virtual machine data
STORAGE-POOL       name of storage pool for virtual machine images

This script will create a directory for storage of virtual machine images, and
register it as a storage pool with libvirt. The script creates the following
directories:

ROOTDIR/STORAGE-POOL      for storage of virtual machine images
ROOTDIR/iso               for storage of operating system install disk ISO 
                          images
EOF
)

if [[ &quot;$1&quot; == &quot;&quot; || &quot;$2&quot; == &quot;&quot; ]] ; then
    echo &quot;${usage}&quot;
    exit 1
fi

ROOTDIR=$1
IMGSTORE=$2

USERNAME=`whoami`
GID=`id -g`
IMGDIR=${ROOTDIR}/${IMGSTORE}

if [[ ! -d ${ROOTDIR} || ! -w ${ROOTDIR} ]] ; then
    echo &quot;Can't write to ${ROOTDIR}.&quot;
    exit 1
fi

# Create the storage pool. Here we could do something like the following:
#
# virsh --connect qemu:///system &quot;\
# pool-define-as ${IMGSTORE}  --type=dir --target=${IMGDIR} ; \
# pool-build ${IMGSTORE} ; \
# pool-start ${IMGSTORE} ; \
# pool-autostart ${IMGSTORE} \
# &quot;
#
# however, then the storage pool will be owned by root, whereas we want it to
# be owned by the user. Unfortunately pool-define-as doesn't have arguments
# for user and group, but it is possible to specify owner and group in an xml
# description and use pool-define. So, we'll do that.

XMLFILE=`mktemp` 

cat &gt; ${XMLFILE} &lt;&lt;EOF
&lt;pool type='dir'&gt;
  &lt;name&gt;${IMGSTORE}&lt;/name&gt;
  &lt;target&gt;
    &lt;path&gt;${IMGDIR}&lt;/path&gt;
    &lt;permissions&gt;
      &lt;mode&gt;0700&lt;/mode&gt;
      &lt;owner&gt;${UID}&lt;/owner&gt;
      &lt;group&gt;${GID}&lt;/group&gt;
    &lt;/permissions&gt;
  &lt;/target&gt;
&lt;/pool&gt;
EOF

echo &quot;Creating storage pool ${IMGSTORE}:&quot;
virsh --connect qemu:///system &quot;\
pool-define ${XMLFILE} ; \
pool-build ${IMGSTORE} ; \
pool-start ${IMGSTORE} ; \
pool-autostart ${IMGSTORE} \
&quot;

if [[ $? -ne 0 ]] ; then
    rm -f ${XMLFILE}
    echo &quot;Could not create storage pool.&quot;
    exit 1
else
    rm -f ${XMLFILE}
    echo &quot;Storage pool \&quot;${USERNAME}-vmstore\&quot; created at ${IMGDIR}.&quot;
    echo &quot;Use this to store your virtual machine images.&quot;
    echo
fi

# Create a directory for storing ISO images
ISODIR=${ROOTDIR}/iso
echo &quot;Creating directory to store OS ISO images at ${ISODIR}:&quot;
mkdir -p ${ISODIR}
if [[ $? -ne 0 ]] ; then
    echo &quot;Failed to create ${ISODIR}.&quot;
    exit 1
else
    chown ${UID}:${GID} ${ISODIR}
    chmod 700 ${ISODIR}
    echo &quot;${ISODIR} created&quot;
    echo &quot;Use this to store any ISO images of operating system installation disks&quot;
fi
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=112&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2012/02/13/multi-user-use-of-virt-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Running openmpi programs inside mock during RPM building</title>
		<link>http://stuckinadoloop.wordpress.com/2012/01/13/running-openmpi-programs-inside-mock-during-rpm-building/</link>
		<comments>http://stuckinadoloop.wordpress.com/2012/01/13/running-openmpi-programs-inside-mock-during-rpm-building/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 16:23:45 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Mock]]></category>
		<category><![CDATA[Package building]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=109</guid>
		<description><![CDATA[Just occasionally it&#8217;s useful to be able to run programs using openmpi inside of a mock chroot when building RPM packages. I just hit this problem myself while building MOLPRO &#8211; during the %build section the makefile tries to execute one of the resulting binaries, which bombs out. The reason it bombs out is actually [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=109&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just occasionally it&#8217;s useful to be able to run programs using openmpi inside of a mock chroot when building RPM packages. I just hit this problem myself while building MOLPRO &#8211; during the %build section the makefile tries to execute one of the resulting binaries, which bombs out. The reason it bombs out is actually discussed in detail <a href="http://permalink.gmane.org/gmane.comp.clustering.open-mpi.user/966"> in this mailing list post</a>. This problem has also been reported <a href="https://bugzilla.redhat.com/show_bug.cgi?id=524511">in the Redhat bugzilla</a>. Googling for &#8220;openmpi chroot&#8221; also brings up various reports. Anyway, the simple work around is to BuildRequire the rsh package. Or touch /usr/bin/rsh. This allows programs to run inside the %build and %check stages when building an RPM, and so is pretty useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=109&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2012/01/13/running-openmpi-programs-inside-mock-during-rpm-building/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Forcing a specific package version with Puppet</title>
		<link>http://stuckinadoloop.wordpress.com/2012/01/06/forcing-a-specific-package-version-with-puppet/</link>
		<comments>http://stuckinadoloop.wordpress.com/2012/01/06/forcing-a-specific-package-version-with-puppet/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 15:28:47 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Puppet]]></category>
		<category><![CDATA[Scientific Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=85</guid>
		<description><![CDATA[Recently I had a need to ensure a specific version of a package (nfs-utils) was present on the systems under Puppet management. Unfortunately, Scientific Linux had pushed a broken update out for nfs-utils (1.2.3-15) and I wanted to ensure all machines had the previous version of the package (1.2.2-7). Puppet 2.6.x does allow you to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=85&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I had a need to ensure a specific version of a package (nfs-utils) was present on the systems under Puppet management. Unfortunately, Scientific Linux had pushed a broken update out for nfs-utils (1.2.3-15) and I wanted to ensure all machines had the previous version of the package (1.2.2-7). Puppet 2.6.x does allow you to specify a specific package version, but if the system already has a later version of the package installed, it doesn&#8217;t have the capability to downgrade the package. This is actually possible with puppet 2.7 &#8211; see <a href="http://projects.puppetlabs.com/issues/2866" target="_blank">this ticket for details.</a>. Anyway, the following snippet demonstrates how to achieve this in puppet 2.6.x using a exec resource:</p>
<pre><code>
  package {'nfs-utils':
    ensure =&gt; '1.2.2-7.el6',
    notify =&gt; Service ['rpcgssd'],
    require =&gt; Exec ['downgrade-nfs-utils'],
  }

  exec {'downgrade-nfs-utils':
    command =&gt; 'yum -y downgrade nfs-utils-1.2.2-7.el6',
    path    =&gt; ['/sbin', '/bin', '/usr/sbin', '/usr/bin'],
    unless  =&gt; 'rpm -qa | grep nfs-utils-1.2.2-7',
  }
</code>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=85&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2012/01/06/forcing-a-specific-package-version-with-puppet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Sometimes&#8230;</title>
		<link>http://stuckinadoloop.wordpress.com/2011/10/07/sometimes/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/10/07/sometimes/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 14:08:15 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=83</guid>
		<description><![CDATA[.. you need to switch off the geek and watch something tranquil and serene. This is what filled that need today.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=83&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>.. you need to switch off the geek and watch something tranquil and serene. This is what filled that need today.</p>
<span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='595' height='365' src='http://www.youtube.com/embed/kkviQ41u0eQ?version=3&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent' frameborder='0'></iframe></span>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=83&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/10/07/sometimes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Deploying FlexLM as an rpm &#8211; spec file and SysV init</title>
		<link>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-flexlm-as-an-rpm-spec-file-and-sysv-init/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-flexlm-as-an-rpm-spec-file-and-sysv-init/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 20:05:05 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Intel compilers]]></category>
		<category><![CDATA[Package building]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=77</guid>
		<description><![CDATA[Where I work we make extensive use of the Intel compiler suite and MKL. Intel makes the compiler and libraries available as rpm packages, which is very convenient. However, we need to use FlexLM running on a license server to serve up our floating licenses. Intel make available a tarball of the recommended (and very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=77&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Where I work we make extensive use of the Intel compiler suite and MKL. Intel makes the compiler and libraries available as rpm packages, which is very convenient. However, we need to use FlexLM running on a license server to serve up our floating licenses. Intel make available a tarball of the recommended (and very old!) version of FlexLM, but it&#8217;s far more handy to have an rpm to deploy. Also, it&#8217;s useful to have a proper SysV init file for the license daemon. Below you can find a spec file and an init file which I hacked together a while ago.</p>
<pre><code>
# Don't generate any debuginfo packages
%global debug_package %{nil}

# Disable rpath checking
%define __arch_install_post %{nil} #/usr/lib/rpm/check-buildroot
%define __spec_install_post %{nil}

Name:           flexlm-intel
Version:        9.23
Release:        5%{?dist}
Summary:        FlexLM license manager for Intel compilers

Group:          Applications/System
License:        Proprietary
URL:            https://registrationcenter.intel.com/
Source0:        flexlm.Linux.EL3.tar.gz
Source1:        lmgrd.intel.init
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires(pre): shadow-utils
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
%description
FlexLM license manager for Intel compilers.

%prep
%setup -q -n flexlm

%build
# Nothing to do.

%install
rm -rf $RPM_BUILD_ROOT

# Binaries
install -d ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 lmgrd.intel ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 INTEL ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 lmutil ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 chklic ${RPM_BUILD_ROOT}%{_bindir}

# init file
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d
install -m 755 %SOURCE1 ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/lmgrd.intel

# License file
install -d ${RPM_BUILD_ROOT}%{_datadir}/intel

install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig

cat &gt; ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/lmgrd.intel &lt;&lt;EOF
LICENSE="/usr/share/intel/intel.lic"
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%pre
getent group intel &gt;/dev/null || groupadd -r intel
getent passwd intel &gt;/dev/null || \
    useradd -r -g intel -d %{_datadir}/intel -s /sbin/nologin \
    -c "Intel license manager" intel
exit 0

%post
/sbin/chkconfig --add lmgrd.intel

%preun
if [ $1 -eq 0 ] ; then
    /sbin/service lmgrd.intel stop &gt;/dev/null 2&gt;&amp;1
    /sbin/chkconfig --del lmgrd.intel
fi

%postun
if [ "$1" -ge "1" ] ; then
    /sbin/service lmgrd.intel condrestart &gt;/dev/null 2&gt;&amp;1 || :
fi

%files
%defattr(-,root,root,-)
%doc HowTo.html END_USER_LICENSE README enduser.pdf
%{_bindir}/*
%{_sysconfdir}/init.d/lmgrd.intel
%{_sysconfdir}/sysconfig/lmgrd.intel
%{_datadir}/intel

%changelog
</code></pre>
<p>And here is the init file:</p>
<pre><code>
#!/bin/sh
#
# lmgrd.intel FlexLM license manager for Intel compiler
#
# chkconfig: 345 99 1
# description: FlexLM license manager for Intel compiler
#              

### BEGIN INIT INFO
# Provides: lmgrd.intel
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs
# Should-Start: $network $local_fs
# Should-Stop: $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Start and stop FlexLM license manager for Intel compiler
# Description: Start and stop FlexLM license manager for Intel compiler
### END INIT INFO

# Source function library.
. /etc/init.d/functions

lmgrd="/usr/bin/lmgrd.intel"
lmutil="/usr//bin/lmutil"
prog="lmgrd.intel"
lockfile=/var/lock/subsys/$prog

LICENSE="/usr/share/intel/intel.lic"
LOGFILE="/var/log/lmgrd.intel"

[ -e /etc/sysconfig/$prog ] &amp;&amp; . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog

[ -x $lmgrd ] || exit 5
[ -x $lmutil ] || exit 5
[ -f $LICENSE ] || exit 6

checklog() {
   [ -f $LOGFILE ] || /bin/touch $LOGFILE
   /bin/chown intel:intel $LOGFILE
}

start() {
    echo -n $"Starting $prog: "
    checklog
    daemon --user intel $lmgrd -c $LICENSE -l $LOGFILE
    retval=$?
    echo
    if [ $retval -eq 0 ] ; then
        touch $lockfile
    fi
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    $lmutil lmdown -c $LICENSE -q &gt;&gt; $LOGFILE
    retval=$?
    echo
    if [ $retval -eq 0 ] ; then
        rm -f $lockfile
        success
    else
        failure
    fi
    return $retval
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

rh_status() {
    $lmutil lmstat -a -c $LICENSE
    return $?
}

rh_status_q() {
    rh_status &gt;/dev/null 2&gt;&amp;1
}

case "$1" in
    start)
#        rh_status_q &amp;&amp; exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    restart)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
        restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
        exit 2
esac
exit $?
</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=77&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-flexlm-as-an-rpm-spec-file-and-sysv-init/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Deploying Matlab as an rpm &#8211; spec file</title>
		<link>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-matlab-as-an-rpm-spec-file/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-matlab-as-an-rpm-spec-file/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 13:26:07 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Matlab]]></category>
		<category><![CDATA[Package building]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=65</guid>
		<description><![CDATA[Similarly to Mathematica, I need to deploy Matlab across a lot of machines, and wanted to automate this via a yum repository. The spec file below can be used to build an rpm of Mathematica. # Don't generate any debuginfo packages %global debug_package %{nil} # Disable rpath checking %define __arch_install_post %{nil} #/usr/lib/rpm/check-buildroot %define __spec_install_post %{nil} [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=65&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Similarly to Mathematica, I need to deploy Matlab across a lot of machines, and wanted to automate this via a yum repository. The spec file below can be used to build an rpm of Mathematica.</p>
<pre><code>
# Don't generate any debuginfo packages
%global debug_package %{nil}

# Disable rpath checking
%define __arch_install_post %{nil} #/usr/lib/rpm/check-buildroot
%define __spec_install_post %{nil}

# Disable automatic dependency and provides information
%define __find_provides %{nil}
%define __find_requires %{nil}
%define _use_internal_dependency_generator 0
Autoprov: 0
Autoreq: 0

Name:           matlab
Version:        2010b
Release:        3%{?dist}
Summary:        A high-level technical computing language and environment

Group:          Applications/Engineering
License:        Proprietary
URL:            http://www.mathworks.com

# Source0 is just the tar and gzipped contents of the install CD iso
Source0:        matlab-2010b.tar.gz
Source1:        network.lic

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:
#Requires:      

%description
MATLAB is a high-level language and interactive environment that
enables you to perform computationally intensive tasks faster than
with traditional programming languages such as C, C++, and Fortran.

%prep
%setup -q

cp %SOURCE1 .

%define destdir /opt/MATLAB/R%{version}

cat &gt; answerfile.txt &lt;&lt;EOF
destinationFolder=${RPM_BUILD_ROOT}/%{destdir}
fileInstallationKey=xxxxx-xxxxx-40427-xxxxx-32825-xxxxx-43181-09302-xxxxx-22930-38724-xxxxx
agreeToLicense=yes
outputFile=matlab_install.log
mode=silent
licensePath=./network.lic
EOF

%build
# Nothing to do - binary distribution

%install
rm -rf $RPM_BUILD_ROOT
./install -inputFile ./answerfile.txt

install -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d

cat &gt; $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/matlab.sh&lt;&lt;EOF
export PATH=\$PATH:%{destdir}/bin
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{destdir}
%{_sysconfdir}/profile.d/*

%changelog

</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=65&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-matlab-as-an-rpm-spec-file/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Deploying Mathematica as an rpm &#8211; spec file</title>
		<link>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-mathematica-as-an-rpm-spec-file/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-mathematica-as-an-rpm-spec-file/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 13:18:40 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Mathematica]]></category>
		<category><![CDATA[Package building]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=62</guid>
		<description><![CDATA[For various reasons I need to deploy Mathematica across a bunch of machines and don&#8217;t want to do this manually. Since I have a local yum repository for locally built software, it&#8217;s handy to be able to deploy an rpm. Of course, we don&#8217;t really want to use all the dependency generation facilities of rpm [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=62&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For various reasons I need to deploy Mathematica across a bunch of machines and don&#8217;t want to do this manually. Since I have a local yum repository for locally built software, it&#8217;s handy to be able to deploy an rpm. Of course, we don&#8217;t really want to use all the dependency generation facilities of rpm as this is nasty binary compiled software which pays no attention to packaging standards but just dumps everything into a directory. Anyhow, this is what seems to work for me:</p>
<pre><code>
# Don&#039;t generate any debuginfo packages
%global debug_package %{nil}

# Disable rpath checking
%define __arch_install_post %{nil}
%define __spec_install_post %{nil}

# Disable automatic dependency and provides information
%define __find_provides %{nil}
%define __find_requires %{nil}
%define _use_internal_dependency_generator 0
Autoprov: 0
Autoreq: 0

Name:           Mathematica
Version:        8.0.1
Release:        3%{?dist}
Summary:        A platform for scientific, engineering, and mathematical computation

Group:          Applications/Engineering
License:        Proprietary
URL:            http://wwww.wolfram.com
Source0:        %{name}_%{version}_LINUX.sh
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:
#Requires:      

%description
Mathematica is a computational software program used in scientific,
engineering, and mathematical fields and other areas of technical
computing.

%prep
%setup -T -c %{name}-%{version}

cp %SOURCE0 .

%build
# Nothing to do

%install
rm -rf $RPM_BUILD_ROOT
%define destdir /opt/%{name}/%{version}

./%{name}_%{version}_LINUX.sh -- \
        -auto -createdir=y -selinux=y -verbose \
        -targetdir=$RPM_BUILD_ROOT%{destdir} \
        -execdir=$RPM_BUILD_ROOT%{destdir}/bin

# Unfortunately the installer script creates absolute symlinks which
# break once files are moved out of the build root. So, we have to
# manually recreate them here as relative links
before=($(echo $RPM_BUILD_ROOT%{destdir}/bin/*))

rm -rf $RPM_BUILD_ROOT%{destdir}/bin/*

for i in `ls $RPM_BUILD_ROOT%{destdir}/Executables` ; do
    ln -s %{destdir}/Executables/${i} $RPM_BUILD_ROOT%{destdir}/bin/${i}
done

ln -s %{destdir}/SystemFiles/Kernel/Binaries/Linux-x86-64/MathematicaScript $RPM_BUILD_ROOT%{destdir}/bin/MathematicaScript

after=($(echo $RPM_BUILD_ROOT%{destdir}/bin/*))

if [ &quot;${before[*]}&quot; != &quot;${after[*]}&quot; ] ; then
   echo &quot;$RPM_BUILD_ROOT%{destdir}/bin doesn&#039;t contain all required symlinks after relinking&quot;
   exit 1
fi

# Fix up prelink error
# prelink: # $BUILDROOT/Mathematica-8.0.1-1.el6.x86_64/opt/Mathematica/8.0.1/SystemFiles/Libraries/Linux/libPHANToMIO.so.4:
# Could not find one of the dependencies)
# See eg. http://www.redhat.com/archives/rpm-list/2008-May/msg00011.html
prelink -u $RPM_BUILD_ROOT%{destdir}/SystemFiles/Libraries/Linux/libPHANToMIO.so.4

# Create mathpass file specifying license server
cat &gt; $RPM_BUILD_ROOT%{destdir}/Configuration/Licensing/mathpass &lt;&lt; EOF
!mathlm-server.some.where.org
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{destdir}
%{_sysconfdir}/profile.d/*

%changelog

</code></pre>
<p>Due to the large number of files being packaged, this takes quite a while to rpmbuild.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=62&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/08/18/deploying-mathematica-as-an-rpm-spec-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Deploying SELinux modules with Puppet (reprise)</title>
		<link>http://stuckinadoloop.wordpress.com/2011/08/17/deploying-selinux-modules-with-puppet-reprise/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/08/17/deploying-selinux-modules-with-puppet-reprise/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 23:23:04 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Puppet]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=58</guid>
		<description><![CDATA[A little while ago I posted this entry about deploying SELinux modules with puppet. I wanted to add a new entry with an updated version of that module, as the originally posted module had a few problems which I resolved over the coming weeks. Posting this was spurred on by James who has posted this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=58&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A little while ago I posted <a href="http://stuckinadoloop.wordpress.com/2011/06/15/puppet-managed-deployment-of-selinux-modules/" title="Puppet managed deployment of SELinux modules"> this entry</a> about deploying SELinux modules with puppet. I wanted to add a new entry with an updated version of that module, as the originally posted module had a few problems which I resolved over the coming weeks. Posting this was spurred on by James who has posted <a href="https://gist.github.com/1152021"> this code on github</a> using some similar ideas (and actually doing an even better job by the looks of it).</p>
<pre>
class semodloader ($moddir = '/usr/local/share/selinux') {

  package { ['policycoreutils',
             'checkpolicy',
             ]: ensure =&gt; latest}

  file {$moddir:
    ensure  =&gt; directory,
    owner   =&gt; 'root',
    group   =&gt; 'root',
    mode    =&gt; 755,
    require =&gt; [ Package['policycoreutils'],
                 Package['checkpolicy'],
                 ],
  }

  define semodule ($source, $status = 'present') {
    case $status {
      present: {
        file {"${semodloader::moddir}/${name}.te":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          source   =&gt; $source,
          require =&gt; File ["${semodloader::moddir}"],
        }

        file {"${semodloader::moddir}/${name}.mod":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          require =&gt; File ["${semodloader::moddir}"],
        }

        file {"${semodloader::moddir}/${name}.pp":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          require =&gt; File ["${semodloader::moddir}"],
        }

        exec {"${name}-buildpp":
          command     =&gt; "checkmodule -M -m -o ${name}.mod ${name}.te ; semodule_package -m ${name}.mod -o ${name}.pp",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
          cwd         =&gt; "${semodloader::moddir}",
          subscribe   =&gt; File ["${semodloader::moddir}/${name}.te"],
          require     =&gt; File ["${semodloader::moddir}/${name}.te"],
          refreshonly =&gt; true,
        }
        selmodule {$name:
          ensure =&gt; present,
          syncversion =&gt; true,
          selmodulepath =&gt; "${semodloader::moddir}/${name}.pp",
          require =&gt; Exec ["${name}-buildpp"],
        }

      }

      absent: {
        file {"${semodloader::moddir}/${name}.te":
          ensure =&gt; absent,
        }

        file {"${semodloader::moddir}/${name}.mod":
          ensure =&gt; absent,
        }
        file {"${semodloader::moddir}/${name}.pp":
          ensure =&gt; absent,
        }

        exec {"${name}-remove":
          command     =&gt; "semodule -r ${name} &gt; /dev/null 2&gt;&amp;1",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
        }
      }

      default: {
        fail("status variable not recognized")
      }

    }
  }
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=58&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/08/17/deploying-selinux-modules-with-puppet-reprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
		<item>
		<title>Puppet managed deployment of SELinux modules</title>
		<link>http://stuckinadoloop.wordpress.com/2011/06/15/puppet-managed-deployment-of-selinux-modules/</link>
		<comments>http://stuckinadoloop.wordpress.com/2011/06/15/puppet-managed-deployment-of-selinux-modules/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 17:32:32 +0000</pubDate>
		<dc:creator>jonathanunderwood</dc:creator>
				<category><![CDATA[Puppet]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://stuckinadoloop.wordpress.com/?p=41</guid>
		<description><![CDATA[Today I needed to work out how to deploy a custom SELinux module across machines using Puppet. For background, this was a small module to make an adjustment to the targetted policy as shipped with RHEL 6 to allow the Kerberos admin daemon to communicate with openldap via a unix socket (i.e. over ldapi://). I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=41&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I needed to work out how to deploy a custom SELinux module across machines using Puppet.</p>
<p>For background, this was a small module to make an adjustment to the targetted policy as shipped with RHEL 6 to allow the Kerberos admin daemon to communicate with openldap via a unix socket (i.e. over ldapi://). I went through the usual drill on a sample machine using audit2allow to generate an SELinux module like this:</p>
<pre>grep kadmin /var/log/audit/audit.log | audit2allow -M kadminldapilocal</pre>
<p>This output two files: kadminldapilocal.te which is a text file describing the policy, and kadminldapilocal.pp which is a compiled binary module. The latter is the thing you need to then load with <code>semodule -i kadminldapilocal.pp</code>.</p>
<p>So, how to deploy this module across machines with puppet? Well, the first way would be to use the native puppet <code>selmodule</code> resource type to deploy the binary SELinux module like this:</p>
<pre>file {'/usr/share/selinux/targeted/kadminldapilocal.pp':
  ensure  =&gt; present,
  owner   =&gt; 'root',
  group   =&gt; 'root',
  mode    =&gt; 644,
  source  =&gt; 'puppet:///kerberos/kadminldapilocal.pp',
}

selmodule {'kadminldapilocal':
  ensure =&gt; present,
  syncversion =&gt; true,
  require =&gt; File ['/usr/share/selinux/targeted/kadminldapilocal.pp'],
}</pre>
<p>But as <a title="" href="http://allmybase.com/2011/04/26/easily-managing-selinux-policies-with-puppet/">Benjamin Rose points out in his blog</a> deploying managing binary SELinux has disadvantages. In particular, if you have your puppet manifests under cversion control, storing a lump of binary in there isn&#8217;t particularly meaningful. Also you become subject to binary compatibility of your SELinux module with the SELinux policy on the machines you&#8217;re deploying to. I don&#8217;t actually know how much of an issue this is in practice, but I could imagine it might be a problem if you have a heterogeneous operating system environment. Anyway, I liked the approach that Ben outlined in his blog post for deploying the SELinux module via the text (.te) files rather than the binary modules, but wanted to reinvent it such that it was self contained within puppet rather than relying on a client side script. So this is what I came up with:</p>
<pre>
class semodloader ($moddir = '/usr/local/share/selinux') {

  package { ['policycoreutils',
             'checkpolicy',
             ]: ensure =&gt; latest}

  file {$moddir:
    ensure  =&gt; directory,
    owner   =&gt; 'root',
    group   =&gt; 'root',
    mode    =&gt; 755,
    require =&gt; [ Package['policycoreutils'],
                 Package['checkpolicy'],
                 ],
  }

  define semodule ($source, $status = 'present') {
    case $status {
      present: {
        file {"${semodloader::moddir}/${name}.te":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          source   =&gt; $source,
          require =&gt; File ["${semodloader::moddir}"],
        }

        file {"${semodloader::moddir}/${name}.mod":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          require =&gt; File ["${semodloader::moddir}"],
        }

        file {"${semodloader::moddir}/${name}.pp":
          owner    =&gt; 'root',
          group    =&gt; 'root',
          mode     =&gt; 644,
          require =&gt; File ["${semodloader::moddir}"],
        }

        exec {"${name}-buildmod":
          command     =&gt; "checkmodule -M -m -o ${name}.mod ${name}.te",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
          cwd         =&gt; "${semodloader::moddir}",
          subscribe   =&gt; File ["${semodloader::moddir}/${name}.te"],
          refreshonly =&gt; true,
        }

        exec {"${name}-buildpp":
          command     =&gt; "semodule_package -m ${name}.mod -o ${name}.pp",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
          cwd         =&gt; "${semodloader::moddir}",
          subscribe   =&gt; File ["${semodloader::moddir}/${name}.mod"],
          refreshonly =&gt; true,
        }

        exec {"${name}-install":
          command     =&gt; "semodule -i ${name}.pp",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
          cwd         =&gt; "${semodloader::moddir}",
          subscribe   =&gt; File ["${semodloader::moddir}/${name}.pp"],
          refreshonly =&gt; true,
        }
        # Alternatively:
        # selmodule {$module:
        #   ensure =&gt; $ensure,
        #   syncversion =&gt; true,
        #   require =&gt; File ["$moddir/$name.pp"],
        # }
      }

      absent: {
        file {"${semodloader::moddir}/${name}.te":
          ensure =&gt; absent,
        }
        file {"${semodloader::moddir}/${name}.mod":
          ensure =&gt; absent,
        }
        file {"${semodloader::moddir}/${name}.pp":
          ensure =&gt; absent,
        }

       exec {"${name}-remove":
          command     =&gt; "semodule -r ${name}.pp &gt; /dev/null 2&gt;&amp;1",
          path        =&gt; ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
        }
      }

      default: {
        fail("status variable not recognized")
      }
    }
  }
}
</pre>
<p>So, to use this to load my kadminldapilocal module, I simply use:</p>
<pre>
  class {'semodloader': }
  semodloader::semodule {'kadminldapilocal':
   source =&gt; 'puppet:///kerberos/kadminldapilocal.te',
   status =&gt; 'present',
 }
</pre>
<p>And, changing <code>status =&gt; 'present'</code> to <code>status =&gt; 'absent'</code> will trigger unloading and removing the module.</p>
<p>Would welcome comments on this, as I am new to puppet (started using it this week), and so can&#8217;t help thinking there must be a simpler way of doing this!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuckinadoloop.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuckinadoloop.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuckinadoloop.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuckinadoloop.wordpress.com&amp;blog=21332920&amp;post=41&amp;subd=stuckinadoloop&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuckinadoloop.wordpress.com/2011/06/15/puppet-managed-deployment-of-selinux-modules/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5f2a8091410f8e0af6a1876a319bb366?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jonathanunderwood</media:title>
		</media:content>
	</item>
	</channel>
</rss>
