<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Ansible-Navigator · Network Doodles</title><link>https://networkdoodles.com/tags/ansible-navigator/</link><description>Network automation, from first playbook to agentic operations. Ansible, NetBox, MCP, Python and the occasional doodle.</description><language>en-us</language><managingEditor>David Henderson</managingEditor><lastBuildDate>Mon, 16 Nov 2026 09:00:00 -0500</lastBuildDate><atom:link href="https://networkdoodles.com/tags/ansible-navigator/index.xml" rel="self" type="application/rss+xml"/><item><title>Execution Environments, ansible-lint and CI for Network Playbooks (Ansible 101 for Networking, Lesson 8)</title><link>https://networkdoodles.com/lessons/ansible-101/production/</link><pubDate>Mon, 16 Nov 2026 09:00:00 -0500</pubDate><dc:creator>David Henderson</dc:creator><guid>https://networkdoodles.com/lessons/ansible-101/production/</guid><category>ansible</category><category>network-automation</category><category>automation</category><category>ansible-navigator</category><category>ci-cd</category><category>howto</category><description>Package Ansible and its collections into an execution environment, run playbooks with ansible-navigator, pass ansible-lint production rules, and gate it in CI.</description><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Over seven lessons the lab went from one ad-hoc command to roles, variables, handlers and a vaulted password.
It all runs from a Python virtual environment in your codespace. That&rsquo;s fine for learning. It isn&rsquo;t how
production should run it, for one boring and important reason: <strong>&ldquo;works on my machine&rdquo; isn&rsquo;t a deployment
strategy.</strong></p>
<p>This last lesson closes that gap with three tools: an <strong>execution environment</strong> so every run uses exactly the
same Ansible, <strong>ansible-lint</strong> so the code meets a standard before anyone reviews it, and a <strong>CI pipeline</strong> so
both happen on every push without anyone remembering to.</p>
<hr>
<h2 id="the-problem-with-pip-install-ansible">The problem with &ldquo;pip install ansible&rdquo;</h2>
<p>Your laptop has ansible-core 2.20.1 and cisco.ios 11.6.0. Your colleague installed a few months earlier and
has older versions of both. The CI runner has whatever was newest when its image was built. The automation server has something else again. Every one of
them runs the same playbook slightly differently, and the differences show up as bugs nobody can reproduce.</p>
<p>An <strong>execution environment</strong> (EE) fixes that by putting Ansible itself in a container:</p>
<ul>
<li>ansible-core, pinned</li>
<li>the collections from <code>requirements.yml</code>, pinned</li>
<li>their Python dependencies</li>
<li>any system packages they need</li>
</ul>
<p>Build it once, tag it, and everything that runs your playbooks (your laptop, CI, Ansible Automation Platform)
uses that same image. If it works in the EE on your machine, it works in the EE everywhere.</p>

<figure class="netsim" data-netsim tabindex="0" aria-label="The same playbook on a laptop, a colleague&#39;s machine and a CI runner with different Ansible versions; an execution environment image pins them so all three runs match; then ansible-lint as the gate before review, on every push. Use the buttons, or the left and right arrow keys, to step through it." data-autoplay="false">
  <svg class="ns-svg" role="img" aria-label="The same playbook on a laptop, a colleague&#39;s machine and a CI runner with different Ansible versions; an execution environment image pins them so all three runs match; then ansible-lint as the gate before review, on every push"></svg>
  <div class="ns-ctl">
    <button class="icon-btn" type="button" data-ns="restart" aria-label="Back to the first step" title="Start again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 5v14M19 5l-9 7 9 7z"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="prev" aria-label="Previous step" title="Previous step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
</button>
    <button class="btn sm primary ns-play" type="button" data-ns="play" aria-pressed="false"><span data-ns-play>Play</span></button>
    <button class="icon-btn" type="button" data-ns="next" aria-label="Next step" title="Next step"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
</button>
    <button class="icon-btn" type="button" data-ns="again" aria-label="Play this step again" title="Play this step again"><svg class="ico" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.5-5.8M4 4v4h4"/></svg>
</button>
    <span class="ns-count mono" data-ns-count></span>
    <button class="btn sm ns-speed" type="button" data-ns="speed" aria-pressed="false">Slow: off</button>
  </div>
  <div class="ns-dots" data-ns-dots role="group" aria-label="Jump to a step"></div>
  <figcaption class="ns-caption" data-ns-caption aria-live="polite"></figcaption>
  <div class="ns-panels">
    <div class="ns-codebox" data-ns-code hidden></div>
    <div class="ns-frame" data-ns-frame hidden></div>
    <div class="ns-tablebox" data-ns-table hidden></div>
  </div>
  <script type="application/json">{"h":340,"links":[],"narrow":{"at":{"ci":[90,400],"col":[90,290],"ee":[265,290,180],"lap":[90,180],"lint":[250,60,190],"pb":[80,60]},"h":470,"w":360},"nodes":{"ci":{"kind":"ci","label":"CI runner","sub":"whatever was newest","x":390,"y":275},"col":{"kind":"laptop","label":"A colleague","sub":"older versions","x":390,"y":165},"ee":{"c":"green","h":44,"hidden":true,"kind":"box","label":"ans101-ee:1","sub":"execution environment","w":190,"x":640,"y":165},"lap":{"kind":"laptop","label":"Your laptop","sub":"core 2.20.1, ios 11.6.0","x":390,"y":55},"lint":{"h":44,"hidden":true,"kind":"box","label":"ansible-lint","sub":"profile: production","w":190,"x":110,"y":280},"pb":{"kind":"file","label":"site.yml","sub":"same playbook","x":90,"y":120}},"steps":[{"hot":["lap","col","ci"],"packets":[{"label":"site.yml","path":["pb","lap"]},{"label":"site.yml","path":["pb","col"]},{"label":"site.yml","path":["pb","ci"]}],"table":{"cols":["machine","Ansible and collections","result"],"rows":[["your laptop","ansible-core 2.20.1, cisco.ios 11.6.0","its own"],["a colleague","older versions of both","its own"],["CI runner","whatever was newest when its image was built","its own"]],"title":"who runs site.yml"},"text":"Each one installed Ansible at a different time, so each runs the same YAML on a different engine and modules.","title":"One playbook, three machines."},{"bad":["col","ci"],"say":{"col":"works on my machine"},"sayAt":{"col":{"narrow":"right","wide":"right"}},"text":"Every one of them runs the playbook slightly differently, and \"works on my machine\" isn't a deployment strategy.","title":"Bugs nobody can reproduce."},{"code":{"hl":[2,5],"lines":["dependencies:","  ansible_core:","    package_pip: ansible-core==2.20.1","  python:","    - ansible-pylibssh==1.4.0","  galaxy: requirements.yml"],"title":"execution-environment.yml"},"hot":["ee"],"show":["ee"],"text":"ansible-core, the collections from `requirements.yml` and their Python dependencies, in one container image.","title":"The EE image pins them."},{"good":["lap","col","ci"],"hot":["ee"],"packets":[{"c":"green","label":"ans101-ee:1","path":["ee","lap"]},{"c":"green","label":"ans101-ee:1","path":["ee","col"]},{"c":"green","label":"ans101-ee:1","path":["ee","ci"]}],"set":{"ci":"ans101-ee:1","col":"ans101-ee:1","lap":"ans101-ee:1"},"table":{"cols":["machine","Ansible and collections","result"],"rows":[["your laptop","ans101-ee:1","same"],["a colleague","ans101-ee:1","same"],["CI runner","ans101-ee:1","same"]],"title":"who runs site.yml"},"text":"`ansible-navigator` runs the playbook in a fresh container from `ans101-ee:1`. Same image, same run, everywhere.","title":"All three run the same image."},{"bad":["lint"],"code":{"lines":["name[play]: All plays should be named.","playbooks/legacy.yml:6:3","","fqcn[action-core]: Use FQCN for builtin module actions (debug).","playbooks/legacy.yml:15:5"],"title":"ansible-lint"},"packets":[{"c":"red","end":"drop","label":"legacy.yml","path":["pb","lint"]}],"show":["lint"],"text":"ansible-lint reads the playbook first. The legacy one runs fine and still fails: no play names, `debug` without its full name.","title":"Lint before a reviewer."},{"code":{"lines":["lint:","  script:","    - yamllint .","    - ansible-lint --offline","","syntax:","  script:","    - ansible-playbook playbooks/site.yml --syntax-check"],"title":".gitlab-ci.yml"},"good":["lint"],"hot":["ci"],"packets":[{"c":"green","label":"push","path":["pb","lint"]}],"text":"CI runs yamllint, ansible-lint and a syntax check of the whole site. A reviewer's time goes on the change itself.","title":"On every push, before review."}],"w":760}</script>
</figure>
<script src="/js/netsim.c40a98d103487ae5866edfa12abb4afc1d3aa7ad2d12fed4fe925fe00b588106.js" integrity="sha256-xAqY0QNIeuWGbt&#43;hKrtK/B06p60tEv7U/pJf4AtYgQY=" defer></script>

<hr>
<h2 id="building-an-ee">Building an EE</h2>
<p>The definition is a short YAML file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="c"># execution-environment.yml</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">images</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">base_image</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">quay.io/fedora/fedora-minimal:43</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">dependencies</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">python_interpreter</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">package_system</span><span class="p">:</span><span class="w"> </span><span class="l">python3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">python_path</span><span class="p">:</span><span class="w"> </span><span class="l">/usr/bin/python3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">ansible_core</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">package_pip</span><span class="p">:</span><span class="w"> </span><span class="l">ansible-core==2.20.1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">ansible_runner</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">package_pip</span><span class="p">:</span><span class="w"> </span><span class="l">ansible-runner==2.4.3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">python</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">ansible-pylibssh==1.4.0</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">galaxy</span><span class="p">:</span><span class="w"> </span><span class="l">requirements.yml</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">options</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">package_manager_path</span><span class="p">:</span><span class="w"> </span><span class="l">/usr/bin/dnf5</span><span class="w">
</span></span></span></code></pre></div><p>The line that matters most is <code>galaxy: requirements.yml</code>. The EE installs the <strong>same pinned collections</strong> the
venv uses, from the same file. One source of truth, two ways to run.</p>
<p>The <code>python:</code> list is the one people forget. Collections bring modules, but some of what they need is plain
Python underneath: <code>network_cli</code> holds its SSH sessions through a library, <code>ansible-pylibssh</code>, that isn&rsquo;t
part of ansible-core. Leave it out and the image builds fine, then fails the first time it talks to a switch.</p>
<p>Build it with <strong>ansible-builder</strong>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ansible-builder build --tag ans101-ee:1 --file execution-environment.yml
</span></span></code></pre></div><p>ansible-builder generates a Containerfile and builds it. A note from building the lab: Red Hat&rsquo;s and the
community&rsquo;s EE base images were x86-only when I tried them, which fails on Apple Silicon. A multi-arch base
like <code>fedora-minimal</code> builds natively everywhere. Check your base image&rsquo;s architectures before you standardise
on it.</p>
<hr>
<h2 id="running-playbooks-with-ansible-navigator">Running playbooks with ansible-navigator</h2>
<p><strong>ansible-navigator</strong> is the front end that runs playbooks <em>inside</em> the EE. Its settings live next to
<code>ansible.cfg</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="c"># ansible-navigator.yml</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">ansible-navigator</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">mode</span><span class="p">:</span><span class="w"> </span><span class="l">stdout</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">execution-environment</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">ans101-ee:1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">pull</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">policy</span><span class="p">:</span><span class="w"> </span><span class="l">never           </span><span class="w"> </span><span class="c"># built locally, never pulled</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">container-options</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&#34;--network=ans101-mgmt&#34;</span><span class="p">]</span><span class="w">
</span></span></span></code></pre></div><p>Then it&rsquo;s almost the command you know:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ansible-navigator run playbooks/site.yml
</span></span></code></pre></div><p>The output is the same PLAY RECAP you&rsquo;ve been reading since lesson 2. What&rsquo;s different is everything underneath:
the playbook ran in a fresh container from a known image, with nothing from your machine except the project
folder.</p>
<p>That <code>container-options</code> line is the one that&rsquo;ll bite you. The EE is a container, so it&rsquo;s on its own network,
and it can&rsquo;t see the switches. Joining it to the switches&rsquo; management network fixes that. In production the
equivalent question is &ldquo;can the EE reach the devices from where it runs?&rdquo;, and it&rsquo;s always worth asking before
the first run, not after.</p>
<p>Drop <code>mode: stdout</code> and navigator opens an interactive TUI instead, where you can step through every play,
task and host result. It&rsquo;s the best way I know to dig into a failed run.</p>
<hr>
<h2 id="ansible-lint-a-standard-before-a-reviewer">ansible-lint: a standard before a reviewer</h2>
<p><strong>ansible-lint</strong> reads your playbooks and roles and tells you what&rsquo;s wrong, from outright bugs to style. The lab
runs it with the strictest built-in profile:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="c"># .ansible-lint</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">profile</span><span class="p">:</span><span class="w"> </span><span class="l">production</span><span class="w">
</span></span></span></code></pre></div><p>Here&rsquo;s the lab&rsquo;s &ldquo;legacy&rdquo; playbook, written the way a lot of real ones are:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl">- <span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l">fabric</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">gather_facts</span><span class="p">:</span><span class="w"> </span><span class="kc">no</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">tasks</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="nt">cisco.ios.ios_command</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">commands</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="l">show version</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">register</span><span class="p">:</span><span class="w"> </span><span class="l">Version</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="nt">debug</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">msg</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;{{inventory_hostname}}: {{ Version.stdout_lines[0][0] }}&#34;</span><span class="w">
</span></span></span></code></pre></div><p>It runs fine. ansible-lint still has a list of complaints, each with a rule name and a line number:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">name[play]: All plays should be named.
</span></span><span class="line"><span class="cl">playbooks/legacy.yml:6:3
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">fqcn[action-core]: Use FQCN for builtin module actions (debug).
</span></span><span class="line"><span class="cl">playbooks/legacy.yml:15:5
</span></span></code></pre></div><p>Between them, the findings cover:</p>
<ul>
<li><strong>No play or task names.</strong> Your output and logs say which module ran, not what happened.</li>
<li><strong><code>debug</code> instead of <code>ansible.builtin.debug</code>.</strong> Fully qualified names say exactly which collection you mean.</li>
<li><strong><code>no</code> instead of <code>false</code>.</strong> YAML 1.1 truthiness is a trap; be explicit.</li>
<li><strong><code>Version</code> with a capital.</strong> Variable names are lowercase by convention, and some tools care.</li>
<li><strong><code>{{inventory_hostname}}</code> with no spaces.</strong> Style, but consistent style is what makes review fast.</li>
<li><strong>Indentation</strong> that YAML accepts and humans misread.</li>
</ul>
<p>Building the lab, ansible-lint also caught my own roles: unprefixed role variables (the reason for <code>base_</code>
in lesson 6) and a template path that climbed out of the playbook folder with <code>../</code>. Both worked; both were the
kind of thing that becomes a bug later. That&rsquo;s what lint is for.</p>
<p>Two rules for living with it:</p>
<ol>
<li><strong>Fix, don&rsquo;t silence.</strong> Every rule can be skipped with a comment. Each skip should have a reason you&rsquo;d
defend in review.</li>
<li><strong>Run it before review, not in review.</strong> A reviewer&rsquo;s time is for &ldquo;is this the right change&rdquo;, not &ldquo;you
forgot a task name&rdquo;.</li>
</ol>
<hr>
<h2 id="ci-so-nobody-has-to-remember">CI: so nobody has to remember</h2>
<p>The last piece runs all of that automatically. The lab&rsquo;s <code>.gitlab-ci.yml</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">default</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">python:3.13-slim</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">before_script</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">echo &#34;${VAULT_PASSWORD:-not-needed-for-lint}&#34; &gt; .vault-pass</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">pip install -q -r requirements.txt</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">ansible-galaxy collection install -r requirements.yml &gt; /dev/null</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">lint</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">script</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">yamllint .</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">ansible-lint --offline</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">syntax</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">script</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="l">ansible-playbook playbooks/site.yml --syntax-check</span><span class="w">
</span></span></span></code></pre></div><p>Every push now gets YAML style, Ansible lint and a syntax check of the whole site. A merge request can&rsquo;t
quietly introduce an unnamed task or a broken role.</p>
<h3 id="where-ci-gets-the-vault-key">Where CI gets the vault key</h3>
<p>Lesson 7 left <code>ansible.cfg</code> pointing at <code>.vault-pass</code>, a file that is never committed. A CI job starts from a
fresh clone, so the file isn&rsquo;t there. The first line of <code>before_script</code> recreates it at the start of every
job, from a CI/CD variable called <code>VAULT_PASSWORD</code>. In GitLab you set that under <em>Settings → CI/CD →
Variables</em> and mark it <strong>masked</strong>, so it never appears in a job log. The key lives in the CI system&rsquo;s secret
store, the job writes it to a file for the length of the run, and the container is thrown away afterwards.</p>
<p>The lab&rsquo;s jobs only lint and syntax-check, which never decrypt anything, so a placeholder is enough when the
variable isn&rsquo;t set. A job that runs playbooks against devices needs the real one.</p>
<p>Notice what CI <em>doesn&rsquo;t</em> do: talk to the switches. GitLab&rsquo;s runners can&rsquo;t reach a lab in your codespace, and in
production you&rsquo;d think hard before giving a shared runner device credentials. The pattern that scales is CI for
everything that can be checked without the network (lint, syntax, schema, templates rendered to files), then a
deploy step that runs check mode against real devices from somewhere that&rsquo;s allowed to reach them, and
finally the real run, gated by a human. That&rsquo;s the <span class="link-soon">GitOps course</span>, next.</p>
<hr>
<h2 id="where-people-get-it-wrong">Where people get it wrong</h2>
<h3 id="1-an-ee-nobody-rebuilds">1. An EE nobody rebuilds</h3>
<p>An EE built once in 2024 and never touched is just a different flavour of &ldquo;works on my machine&rdquo;. Rebuild it
when <code>requirements.yml</code> changes, tag it with a version, and keep its definition in the same repo as the
playbooks.</p>
<h3 id="2-latest">2. <code>latest</code></h3>
<p><code>image: my-ee:latest</code> means today&rsquo;s run and tomorrow&rsquo;s run may use different Ansible. Tag EEs with versions and
pin them in <code>ansible-navigator.yml</code>, exactly like collections.</p>
<h3 id="3-lint-that-only-runs-on-laptops">3. Lint that only runs on laptops</h3>
<p>If lint isn&rsquo;t in CI, it&rsquo;s a suggestion. Put it in the pipeline from day one, while the codebase is small enough
to make clean.</p>
<h3 id="4-a-pipeline-with-device-credentials">4. A pipeline with device credentials</h3>
<p>The fastest way to turn a CI compromise into a network compromise. Keep device access in a dedicated, audited
place (AAP, or a locked-down runner), and keep the shared pipeline to the checks that don&rsquo;t need it.</p>
<hr>
<h2 id="you-did-it">You did it</h2>
<p>That&rsquo;s Ansible 101 for networking. Eight lessons ago this was an inventory file and an ad-hoc command. Now it&rsquo;s
two roles with defaults and handlers, configuring a leaf-spine fabric from data, with a vaulted password,
running in an execution environment, lint-clean, with a pipeline. That&rsquo;s not a toy. That&rsquo;s the structure real
network automation teams use.</p>
<p><a href="/labs/ansible-101/#chapter-8">Chapter 8 of the lab</a> builds the EE and runs <code>site.yml</code> in it, cleans up the
legacy playbook until ansible-lint passes, and adds the lint and syntax jobs to the pipeline.</p>
<p>Where next? The <span class="link-soon">GitOps for networks</span> course takes this repo and puts it behind
merge requests, reviews and a deploy pipeline. And the <span class="link-soon">NetBox course</span> replaces the
inventory files with NetBox as your source of truth.</p>
]]></content:encoded></item></channel></rss>