<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<ul dir="auto">
<li>with_sequence</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook 2.3.2.0"><pre class="notranslate"><code class="notranslate">ansible-playbook 2.3.2.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">3.10.0-514.6.2.el7.x86_64</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">This is my playbook.</p>
<hr>
<ul dir="auto">
<li>hosts: all<br>
tasks:
<ul dir="auto">
<li>name: sequence check<br>
debug:<br>
msg: "sequence is {{ item }}"<br>
with_sequence: start=1 end=5</li>
</ul>
</li>
</ul>
<p dir="auto">I'm expecting the order 1,2,3,4,5  in order , but this prints the item in random fashion.</p>
<p dir="auto">ok: [web01] =&gt; (item=3) =&gt; {<br>
"item": "3",<br>
"msg": "sequence is 3"<br>
}<br>
ok: [web01] =&gt; (item=2) =&gt; {<br>
"item": "2",<br>
"msg": "sequence is 2"<br>
}<br>
ok: [web01] =&gt; (item=1) =&gt; {<br>
"item": "1",<br>
"msg": "sequence is 1"<br>
}<br>
ok: [web01] =&gt; (item=5) =&gt; {<br>
"item": "5",<br>
"msg": "sequence is 5"<br>
}<br>
ok: [web01] =&gt; (item=4) =&gt; {<br>
"item": "4",<br>
"msg": "sequence is 4"<br>
}</p>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">expected order -  print  sequence from 1 to 5 in order</p>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">core</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.1.0
ansible 2.3.0"><pre class="notranslate"><code class="notranslate">ansible 2.2.1.0
ansible 2.3.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS Linux 7</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">List order is lost using with_items</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- hosts: localhost
  vars:
    with_dict_test:
      - { key: 'one', value: 1 }
      - { key: 'two', value: 2 }
      - { key: 'three', value: 3 }
      - { key: 'four', value: 4 }
      - { key: 'five', value: 5 }
      - { key: 'six', value: 6 }
  tasks:
      - name: with_dict test
        debug: msg=&quot;{{item.key}} --&gt; {{item.value}}&quot;
        with_items: &quot;{{ with_dict_test}}&quot;"><pre class="notranslate">---
- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">vars</span>:
    <span class="pl-ent">with_dict_test</span>:
      - <span class="pl-s">{ key: 'one', value: 1 }</span>
      - <span class="pl-s">{ key: 'two', value: 2 }</span>
      - <span class="pl-s">{ key: 'three', value: 3 }</span>
      - <span class="pl-s">{ key: 'four', value: 4 }</span>
      - <span class="pl-s">{ key: 'five', value: 5 }</span>
      - <span class="pl-s">{ key: 'six', value: 6 }</span>
  <span class="pl-ent">tasks</span>:
      - <span class="pl-ent">name</span>: <span class="pl-s">with_dict test</span>
        <span class="pl-ent">debug</span>: <span class="pl-s">msg="{{item.key}} --&gt; {{item.value}}"</span>
        <span class="pl-ent">with_items</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ with_dict_test}}<span class="pl-pds">"</span></span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [localhost] =&gt; (item={u'value': 1, u'key': u'one'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;one&quot;, 
        &quot;value&quot;: 1
    }, 
    &quot;msg&quot;: &quot;one --&gt; 1&quot;
}
ok: [localhost] =&gt; (item={u'value': 2, u'key': u'two'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;two&quot;, 
        &quot;value&quot;: 2
    }, 
    &quot;msg&quot;: &quot;two --&gt; 2&quot;
}
ok: [localhost] =&gt; (item={u'value': 3, u'key': u'three'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;three&quot;, 
        &quot;value&quot;: 3
    }, 
    &quot;msg&quot;: &quot;three --&gt; 3&quot;
}
ok: [localhost] =&gt; (item={u'value': 4, u'key': u'four'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;four&quot;, 
        &quot;value&quot;: 4
    }, 
    &quot;msg&quot;: &quot;four --&gt; 4&quot;
}
ok: [localhost] =&gt; (item={u'value': 5, u'key': u'five'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;five&quot;, 
        &quot;value&quot;: 5
    }, 
    &quot;msg&quot;: &quot;five --&gt; 5&quot;
}
ok: [localhost] =&gt; (item={u'value': 6, u'key': u'six'}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;six&quot;, 
        &quot;value&quot;: 6
    }, 
    &quot;msg&quot;: &quot;six --&gt; 6&quot;
}"><pre class="notranslate"><code class="notranslate">ok: [localhost] =&gt; (item={u'value': 1, u'key': u'one'}) =&gt; {
    "item": {
        "key": "one", 
        "value": 1
    }, 
    "msg": "one --&gt; 1"
}
ok: [localhost] =&gt; (item={u'value': 2, u'key': u'two'}) =&gt; {
    "item": {
        "key": "two", 
        "value": 2
    }, 
    "msg": "two --&gt; 2"
}
ok: [localhost] =&gt; (item={u'value': 3, u'key': u'three'}) =&gt; {
    "item": {
        "key": "three", 
        "value": 3
    }, 
    "msg": "three --&gt; 3"
}
ok: [localhost] =&gt; (item={u'value': 4, u'key': u'four'}) =&gt; {
    "item": {
        "key": "four", 
        "value": 4
    }, 
    "msg": "four --&gt; 4"
}
ok: [localhost] =&gt; (item={u'value': 5, u'key': u'five'}) =&gt; {
    "item": {
        "key": "five", 
        "value": 5
    }, 
    "msg": "five --&gt; 5"
}
ok: [localhost] =&gt; (item={u'value': 6, u'key': u'six'}) =&gt; {
    "item": {
        "key": "six", 
        "value": 6
    }, 
    "msg": "six --&gt; 6"
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [localhost] =&gt; (item={u'key': u'one', u'value': 1}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;one&quot;, 
        &quot;value&quot;: 1
    }, 
    &quot;msg&quot;: &quot;one --&gt; 1&quot;
}
ok: [localhost] =&gt; (item={u'key': u'six', u'value': 6}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;six&quot;, 
        &quot;value&quot;: 6
    }, 
    &quot;msg&quot;: &quot;six --&gt; 6&quot;
}
ok: [localhost] =&gt; (item={u'key': u'five', u'value': 5}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;five&quot;, 
        &quot;value&quot;: 5
    }, 
    &quot;msg&quot;: &quot;five --&gt; 5&quot;
}
ok: [localhost] =&gt; (item={u'key': u'four', u'value': 4}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;four&quot;, 
        &quot;value&quot;: 4
    }, 
    &quot;msg&quot;: &quot;four --&gt; 4&quot;
}
ok: [localhost] =&gt; (item={u'key': u'three', u'value': 3}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;three&quot;, 
        &quot;value&quot;: 3
    }, 
    &quot;msg&quot;: &quot;three --&gt; 3&quot;
}
ok: [localhost] =&gt; (item={u'key': u'two', u'value': 2}) =&gt; {
    &quot;item&quot;: {
        &quot;key&quot;: &quot;two&quot;, 
        &quot;value&quot;: 2
    }, 
    &quot;msg&quot;: &quot;two --&gt; 2&quot;
}
"><pre class="notranslate"><code class="notranslate">ok: [localhost] =&gt; (item={u'key': u'one', u'value': 1}) =&gt; {
    "item": {
        "key": "one", 
        "value": 1
    }, 
    "msg": "one --&gt; 1"
}
ok: [localhost] =&gt; (item={u'key': u'six', u'value': 6}) =&gt; {
    "item": {
        "key": "six", 
        "value": 6
    }, 
    "msg": "six --&gt; 6"
}
ok: [localhost] =&gt; (item={u'key': u'five', u'value': 5}) =&gt; {
    "item": {
        "key": "five", 
        "value": 5
    }, 
    "msg": "five --&gt; 5"
}
ok: [localhost] =&gt; (item={u'key': u'four', u'value': 4}) =&gt; {
    "item": {
        "key": "four", 
        "value": 4
    }, 
    "msg": "four --&gt; 4"
}
ok: [localhost] =&gt; (item={u'key': u'three', u'value': 3}) =&gt; {
    "item": {
        "key": "three", 
        "value": 3
    }, 
    "msg": "three --&gt; 3"
}
ok: [localhost] =&gt; (item={u'key': u'two', u'value': 2}) =&gt; {
    "item": {
        "key": "two", 
        "value": 2
    }, 
    "msg": "two --&gt; 2"
}

</code></pre></div>