<?xml version="1.0"?>
<rss version="2.0"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Tyler Cipriani: pages tagged configuration-management</title>
<link>https://tylercipriani.com/tags/configuration-management/</link>
<atom:link href="https://tylercipriani.com/tags/configuration-management/index.rss" rel="self" type="application/rss+xml"/>

<description>Tyler Cipriani</description>
<generator>ikiwiki</generator>
<pubDate>Tue, 14 Feb 2017 15:11:05 +0000</pubDate>
<item>
	<title>Puppet, apt-get-update, source-lists, and Dumbness</title>

	<guid isPermaLink="false">https://tylercipriani.com/blog/2015/05/23/Puppet-Apt-get-update-Source-lists-and-Dumbness/</guid>

	<link>https://tylercipriani.com/blog/2015/05/23/Puppet-Apt-get-update-Source-lists-and-Dumbness/</link>

	<dc:creator>Tyler Cipriani</dc:creator>



	<category>computing</category>

	<category>configuration-management</category>


	<pubDate>Sat, 23 May 2015 00:00:00 +0000</pubDate>
	<dcterms:modified>2017-02-14T15:11:05Z</dcterms:modified>


	<description>&lt;p&gt;Configuration management software is nice because it lets you be a little dumb. Puppet, Chef, Ansible, and Salt have all managed to smooth down many of the rough edges that were ubiquitous in the terrible bash and perl scripts used for old-time, ad-hoc configuration management.&lt;/p&gt;
&lt;p&gt;My main problem with configuration management software is that &lt;em&gt;I’m still dumb&lt;/em&gt;. I’m still dumb and there are now new, non-obvious, ways to be dumb.&lt;/p&gt;
&lt;p&gt;One non-obvious example is below:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ruby numberLines&quot;&gt;&lt;code class=&quot;sourceCode ruby&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;package { &lt;span class=&quot;st&quot;&gt;&amp;#39;apache&amp;#39;&lt;/span&gt;:&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;ensure&lt;/span&gt;  =&amp;gt; installed,&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;    require =&amp;gt; &lt;span class=&quot;dt&quot;&gt;File&lt;/span&gt;[&lt;span class=&quot;st&quot;&gt;&amp;#39;/etc/apt/sources.list.d/some_source.list&amp;#39;&lt;/span&gt;]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;}&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-6&quot; title=&quot;6&quot;&gt;file { &lt;span class=&quot;st&quot;&gt;&amp;#39;/etc/apt/sources.list.d/some_source.list&amp;#39;&lt;/span&gt;:&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-7&quot; title=&quot;7&quot;&gt;    notify =&amp;gt; &lt;span class=&quot;dt&quot;&gt;Exec&lt;/span&gt;[&lt;span class=&quot;st&quot;&gt;&amp;#39;apt-get update&amp;#39;&lt;/span&gt;],&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-8&quot; title=&quot;8&quot;&gt;    source =&amp;gt; ...&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-9&quot; title=&quot;9&quot;&gt;}&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-10&quot; title=&quot;10&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-11&quot; title=&quot;11&quot;&gt;exec { &lt;span class=&quot;st&quot;&gt;&amp;#39;apt-get update&amp;#39;&lt;/span&gt;: }&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On the surface, this little contrived example seems fine: Apache requires a special source, adding that source triggers an &lt;code&gt;apt-get update&lt;/code&gt;. Therefore, before Apache is installed, our sources list should be up-to-date, right? Wrong.&lt;/p&gt;
&lt;p&gt;The problem here is subtle: the &lt;code&gt;notify =&amp;gt; Exec[&#39;apt-get update&#39;]&lt;/code&gt; in the file resource means that the file &lt;code&gt;&quot;/etc/apt/sources.d/${name}.list&quot;&lt;/code&gt; has to exist before &lt;code&gt;apt-get update&lt;/code&gt; is run. Adding &lt;code&gt;require =&amp;gt; File[&#39;/etc/apt/sources.list.d/some_source.list&#39;]&lt;/code&gt; to the Apache package means that it will be installed only after &lt;code&gt;&quot;/etc/apt/sources.d/${name}.list&quot;&lt;/code&gt; gets added.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HOWEVER&lt;/strong&gt;, the Apache package, currently, has no relationship with &lt;code&gt;apt-get update&lt;/code&gt;. This means Puppet may try to install the Apache package &lt;em&gt;after&lt;/em&gt; adding &lt;code&gt;/etc/apt/sources.d/some_source.list&lt;/code&gt;, but &lt;em&gt;before&lt;/em&gt; running &lt;code&gt;apt-get update&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;While the short example above is not a problem in isolation, it &lt;em&gt;can be&lt;/em&gt; a problem in a larger manifest. Puppet will succeed with some packages, fail in others, then create &lt;a href=&quot;http://en.wikipedia.org/wiki/Dependency_hell&quot;&gt;unresolvable dependency conflicts&lt;/a&gt; on the next run (after &lt;code&gt;apt-get update&lt;/code&gt; has run).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;—2016-03-20&lt;/p&gt;
&lt;p&gt;This relationship is easier to see when you take advantage of puppet’s &lt;code&gt;--graph&lt;/code&gt; ability:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;puppet&lt;/span&gt; apply --graph test.pp dot -Tpng /var/lib/puppet/state/graphs/relationships.dot -o Pictures/relationships.png&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;https://tylercipriani.com/static/images/2016/2016-03-20_puppet-dot.png&quot; alt=&quot;Puppet relationship graph&quot; /&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
</description>


	<comments>//tylercipriani.com/blog/2015/05/23/Puppet-Apt-get-update-Source-lists-and-Dumbness/#comments</comments>

</item>

</channel>
</rss>
