title: Using set_facts and with_items together in Ansible
body: <p>I'm currently using Ansible 1.7.2.  I have the following test playbook:</p>
  
  <pre><code>---
  - hosts: localhost
    tasks:
    - name: set fact 1
      set_fact: foo="[ 'zero' ]"
  
    - name: set fact 2
      set_fact: foo="{{ foo }} + [ 'one' ]"
  
    - name: set fact 3
      set_fact: foo="{{ foo }} + [ 'two', 'three' ]"
  
    - name: set fact 4
      set_fact: foo="{{ foo }} + [ '{{ item }}' ]"
      with_items:
        - four
        - five
        - six
  
    - debug: var=foo
  </code></pre>
  
  <p>The first task sets a fact that's a list with one item in it.  The subsequent tasks append to that list with more values.  The first three tasks work as expected, but the last one doesn't.  Here's the output when I run this:</p>
  
  <pre><code>PLAY [localhost] **************************************************************
  
  GATHERING FACTS ***************************************************************
  ok: [localhost]
  
  TASK: [set fact 1] ************************************************************
  ok: [localhost]
  
  TASK: [set fact 2] ************************************************************
  ok: [localhost]
  
  TASK: [set fact 3] ************************************************************
  ok: [localhost]
  
  TASK: [set fact 4] ************************************************************
  ok: [localhost] =&gt; (item=four)
  ok: [localhost] =&gt; (item=five)
  ok: [localhost] =&gt; (item=six)
  
  TASK: [debug var=foo] *********************************************************
  ok: [localhost] =&gt; {
      "foo": [
          "zero",
          "one",
          "two",
          "three",
          "six"
      ]
  }
  
  PLAY RECAP ********************************************************************
  localhost                  : ok=6    changed=0    unreachable=0    failed=0
  </code></pre>
  
  <p>Given the with_items in task 4 and the fact that the output shows the task properly iterated over the items in that list, I would have expected the result to contain all the numbers zero through six. But that last task seems to only be evaluating set_fact with the last item in the list.  Is this possibly a bug in Ansible?</p>
  
  <p>Edit: I also just tested this on ansible 1.8 and the output was identical.</p>