<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Loop_control on C2 Platform</title><link>https://next.c2platform.org/tags/loop_control/</link><description>Recent content in Loop_control on C2 Platform</description><generator>Hugo</generator><language>en</language><atom:link href="https://next.c2platform.org/tags/loop_control/index.xml" rel="self" type="application/rss+xml"/><item><title>Using item and loop_var in Ansible Loops</title><link>https://next.c2platform.org/docs/guidelines/coding/item-loop-var/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.c2platform.org/docs/guidelines/coding/item-loop-var/</guid><description>&lt;div class="alert alert-primary" role="alert">


 Use &lt;code>item&lt;/code> as the default loop variable in Ansible loops. Introduce a custom
&lt;code>loop_control.loop_var&lt;/code> only when &lt;code>item&lt;/code> would clash across loop boundaries,
for example in &lt;code>include_tasks&lt;/code> or nested loops.

&lt;/div>

&lt;h2 id="problem">Problem&lt;/h2>
&lt;p>The default loop variable &lt;code>item&lt;/code> is convenient and familiar, and in most cases
it is the best choice. Problems start when &lt;code>item&lt;/code> is reused across loop
boundaries, for example when &lt;code>include_tasks&lt;/code> passes loop data into another file
or when loops are nested.&lt;/p></description></item></channel></rss>