<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Devops on iMil.net</title>
    <link>http://imil.net/blog/tags/devops/</link>
    <description>Recent content in Devops on iMil.net</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 25 Mar 2017 12:23:18 +0000</lastBuildDate>
    <atom:link href="http://imil.net/blog/tags/devops/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Ansible playbook with packer in Jenkins</title>
      <link>http://imil.net/blog/posts/2017/ansible-playbook-with-packer-in-jenkins/</link>
      <pubDate>Sat, 25 Mar 2017 12:23:18 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2017/ansible-playbook-with-packer-in-jenkins/</guid>
      <description>&lt;p&gt;Quick one.&lt;/p&gt;&#xA;&lt;p&gt;While working on a build chain in order to register home-baked &lt;em&gt;AMIs&lt;/em&gt;, I wanted to use the &lt;code&gt;ansible-local&lt;/code&gt; &lt;a href=&#34;https://www.packer.io/&#34;&gt;packer&lt;/a&gt; &lt;em&gt;provisioner&lt;/em&gt; to setup the instance with a very basic &lt;em&gt;playbook&lt;/em&gt;. I needed to provide &lt;code&gt;ansible&lt;/code&gt; a playbook but didn&amp;rsquo;t find immediately how to achieve this within the &lt;a href=&#34;https://wiki.jenkins-ci.org/display/JENKINS/Packer+Plugin&#34;&gt;Jenkins-packer&lt;/a&gt; module. Turns out it&amp;rsquo;s tricky, in the &lt;em&gt;JSON Template Text&lt;/em&gt; (or the template file), declare the &lt;code&gt;playbook_file&lt;/code&gt; like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  [{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ansible-local&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;playbook_file&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{{ user `test_yml` }}&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;command&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;PYTHONUNBUFFERED=1 ansible-playbook&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then in the &lt;em&gt;File Entries&lt;/em&gt; field, the &lt;em&gt;Variable Name&lt;/em&gt; must be &lt;code&gt;test_yml&lt;/code&gt; and &lt;em&gt;File Contents&lt;/em&gt; filled with the playbook.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rock your CloudFormation with troposphere and boto</title>
      <link>http://imil.net/blog/posts/2015/rock-your-cloudformation-with-troposphere-and-boto/</link>
      <pubDate>Thu, 04 Jun 2015 10:55:48 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2015/rock-your-cloudformation-with-troposphere-and-boto/</guid>
      <description>&lt;p&gt;So you&amp;rsquo;re using &lt;a href=&#34;http://aws.amazon.com/fr/cloudformation/&#34;&gt;AWS CloudFormation&lt;/a&gt; in order to bring up complex infrastructures; haven&amp;rsquo;t you already told yourself that instead of writing down all those &lt;code&gt;JSON&lt;/code&gt; lines by hand, you could bring more fun to your architect life?&#xA;I did, and I found a way to programmatically design a whole architecture using &lt;a href=&#34;https://github.com/cloudtools/troposphere/&#34;&gt;troposphere&lt;/a&gt; and &lt;a href=&#34;http://boto3.readthedocs.org/en/latest/&#34;&gt;boto3&lt;/a&gt;.&#xA;Simply put, &lt;a href=&#34;https://github.com/cloudtools/troposphere/&#34;&gt;troposphere&lt;/a&gt; gives you bindings in order to generate &lt;em&gt;CloudFormation&lt;/em&gt;&amp;rsquo;s &lt;code&gt;JSON&lt;/code&gt; template, but hey, it&amp;rsquo;s python, meaning that you can create loops, use conditions and even dynamically build objects.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
