<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Ec2_group - Tag - Filipe Felisbino</title><link>https://felisbino.dev/tags/ec2_group/</link><description>Ec2_group - Tag - Filipe Felisbino</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 20 Jan 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://felisbino.dev/tags/ec2_group/" rel="self" type="application/rss+xml"/><item><title>Ansible: Using with_nested to merge a list with a dict</title><link>https://felisbino.dev/posts/ansible-nested-example/</link><pubDate>Wed, 20 Jan 2016 00:00:00 +0000</pubDate><author>Filipe Felisbino</author><guid>https://felisbino.dev/posts/ansible-nested-example/</guid><description><![CDATA[<p>I make heavy use of Ansible for AWS infrastructure provisioning. From creating VPCs, subnets, EC2 instances, security groups and so on.</p>
<p>Because we have a central point where we define per-environment networks, I recently got stuck with having to convert a list of subnets (just strings) to a list of dicts to be used by the <code>ec2_group</code> module. My list of subnets was something like:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code>internal_networks:
  - 10.100.32.0/20
  - 10.100.128.0/20
  - 10.100.144.0/20
  - 10.50.128.0/20
  - 10.50.144.0/20</code></pre></div>
<p>While the <code>ec2_group</code> expects its rules to be something like:</p>]]></description></item></channel></rss>