<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Unarchive module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">Both 2.1.1.0 and 2.1.0.0 on multiple Macs.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.1.0
  config file = 
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.1.1.0
  config file = 
  configured module search path = Default w/o overrides
</code></pre></div>
<p dir="auto">also</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.0.0
  config file = 
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.1.0.0
  config file = 
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">No special settings. default config.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Mac OS X version 10.11.6, installed via Homebrew</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The Unarchive module fails when trying to <em>locally</em> download/expand the current Ansible snapshot from GitHub. (<a href="https://github.com/ansible/ansible/archive/devel.zip">https://github.com/ansible/ansible/archive/devel.zip</a> The playbook in this report is downloading the equivalent archive based on the last-commited hash.)</p>
<p dir="auto">Note that the archive can be manually downloaded and expanded on OS X.</p>
<p dir="auto">Found this while trying to isolate a different problem with the Unarchive module related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="170039309" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/17009" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/17009/hovercard" href="https://github.com/ansible/ansible/issues/17009">#17009</a>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Ran this command:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook -vvv ~/Desktop/ansible-local-test.yaml"><pre class="notranslate"><code class="notranslate">ansible-playbook -vvv ~/Desktop/ansible-local-test.yaml
</code></pre></div>
<p dir="auto">Complete playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---

- hosts: localhost
  become: no
  connection: local

  tasks:
    - name: Download &amp; Unpack zip archive
      unarchive: 
        src: https://github.com/ansible/ansible/archive/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip
        dest: /tmp/
        copy: no

"><pre class="notranslate"><code class="notranslate">
---

- hosts: localhost
  become: no
  connection: local

  tasks:
    - name: Download &amp; Unpack zip archive
      unarchive: 
        src: https://github.com/ansible/ansible/archive/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip
        dest: /tmp/
        copy: no


</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Archive downloads and unpacks.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Module failure.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="No config file found; using defaults
 [WARNING]: Host file not found: /usr/local/etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available


PLAYBOOK: ansible-local-test.yaml **********************************************
1 plays in /Users/joe/Desktop/ansible-local-test.yaml

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: joe
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `&quot; &amp;&amp; echo ansible-tmp-1470768855.09-223451903953364=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpUDTEJa TO /Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/setup
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/setup; rm -rf &quot;/Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
ok: [localhost]

TASK [Download &amp; Unpack zip archive] *******************************************
task path: /Users/joe/Desktop/ansible-local-test.yaml:16
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: joe
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `&quot; &amp;&amp; echo ansible-tmp-1470768856.18-10151565722253=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `&quot; &amp;&amp; echo ansible-tmp-1470768856.29-136530177465962=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmp5mz6bv TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/stat
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/stat; rm -rf &quot;/Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `&quot; &amp;&amp; echo ansible-tmp-1470768856.64-39284039925999=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpwQtO7G TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/unarchive
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/unarchive; rm -rf &quot;/Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'rm -f -r /Users/joe/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253/ &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
fatal: [localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;dest&quot;: &quot;/tmp/&quot;, &quot;failed&quot;: true, &quot;gid&quot;: 0, &quot;group&quot;: &quot;wheel&quot;, &quot;handler&quot;: &quot;TgzArchive&quot;, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;backup&quot;: null, &quot;content&quot;: null, &quot;copy&quot;: false, &quot;creates&quot;: null, &quot;delimiter&quot;: null, &quot;dest&quot;: &quot;/tmp/&quot;, &quot;directory_mode&quot;: null, &quot;exclude&quot;: [], &quot;extra_opts&quot;: [], &quot;follow&quot;: false, &quot;force&quot;: null, &quot;group&quot;: null, &quot;keep_newer&quot;: false, &quot;list_files&quot;: false, &quot;mode&quot;: null, &quot;original_basename&quot;: &quot;df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip&quot;, &quot;owner&quot;: null, &quot;regexp&quot;: null, &quot;remote_src&quot;: null, &quot;selevel&quot;: null, &quot;serole&quot;: null, &quot;setype&quot;: null, &quot;seuser&quot;: null, &quot;src&quot;: &quot;https://github.com/ansible/ansible/archive/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip&quot;}}, &quot;mode&quot;: &quot;01777&quot;, &quot;msg&quot;: &quot;Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/tmp/ansible-df81f1197f01ff29e2f3afeea228daf7d3ec81bb/'&quot;, &quot;owner&quot;: &quot;root&quot;, &quot;size&quot;: 1224, &quot;src&quot;: &quot;/private/var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/ansible_uoZAK4/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip&quot;, &quot;state&quot;: &quot;directory&quot;, &quot;uid&quot;: 0}

NO MORE HOSTS LEFT *************************************************************
    to retry, use: --limit @/Users/joe/Desktop/ansible-local-test.retry

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1   
"><pre class="notranslate"><code class="notranslate">No config file found; using defaults
 [WARNING]: Host file not found: /usr/local/etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available


PLAYBOOK: ansible-local-test.yaml **********************************************
1 plays in /Users/joe/Desktop/ansible-local-test.yaml

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: joe
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `" &amp;&amp; echo ansible-tmp-1470768855.09-223451903953364="` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpUDTEJa TO /Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/setup
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/setup; rm -rf "/Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
ok: [localhost]

TASK [Download &amp; Unpack zip archive] *******************************************
task path: /Users/joe/Desktop/ansible-local-test.yaml:16
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: joe
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `" &amp;&amp; echo ansible-tmp-1470768856.18-10151565722253="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `" &amp;&amp; echo ansible-tmp-1470768856.29-136530177465962="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmp5mz6bv TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/stat
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/stat; rm -rf "/Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `" &amp;&amp; echo ansible-tmp-1470768856.64-39284039925999="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpwQtO7G TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/unarchive
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/unarchive; rm -rf "/Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'rm -f -r /Users/joe/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253/ &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
fatal: [localhost]: FAILED! =&gt; {"changed": false, "dest": "/tmp/", "failed": true, "gid": 0, "group": "wheel", "handler": "TgzArchive", "invocation": {"module_args": {"backup": null, "content": null, "copy": false, "creates": null, "delimiter": null, "dest": "/tmp/", "directory_mode": null, "exclude": [], "extra_opts": [], "follow": false, "force": null, "group": null, "keep_newer": false, "list_files": false, "mode": null, "original_basename": "df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "https://github.com/ansible/ansible/archive/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip"}}, "mode": "01777", "msg": "Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/tmp/ansible-df81f1197f01ff29e2f3afeea228daf7d3ec81bb/'", "owner": "root", "size": 1224, "src": "/private/var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/ansible_uoZAK4/df81f1197f01ff29e2f3afeea228daf7d3ec81bb.zip", "state": "directory", "uid": 0}

NO MORE HOSTS LEFT *************************************************************
    to retry, use: --limit @/Users/joe/Desktop/ansible-local-test.retry

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1   

</code></pre></div>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">1.4.5</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">OSX but probably N/A</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto"><code class="notranslate">set_var</code> sometimes interprets JSON formatted data into an object, and other times it keeps it as a unicode string.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">The following test playbook demonstrates inconsistent behavior with set_var in "short" vs "extended" mode.</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
---
- name: test
  hosts: localhost
  gather_facts: False
  tasks:
    - local_action: 'command echo ''{&quot;a&quot;: 1, &quot;b&quot;: 2}'''
      register: out
    - set_fact:
        foo: &quot;{{ out.stdout }}&quot;
    - set_fact: bar=&quot;{{ out.stdout }}&quot;
    - set_fact: baz=&quot;{{ out.stdout | from_json }}&quot;
    - debug: var=foo
    - debug: var=bar
    - debug: var=baz
    - debug: msg=&quot;{{ foo.a }}&quot;
    - debug: msg=&quot;{{ bar.a }}&quot;
      ignore_errors: True
    - debug: msg=&quot;{{ baz.a }}&quot;
      ignore_errors: True"><pre class="notranslate">---
- <span class="pl-ent">name</span>: <span class="pl-s">test</span>
  <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-c1">False</span>
  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">local_action</span>: <span class="pl-s"><span class="pl-pds">'</span>command echo <span class="pl-cce">''</span>{"a": 1, "b": 2}<span class="pl-cce">''</span><span class="pl-pds">'</span></span>
      <span class="pl-ent">register</span>: <span class="pl-s">out</span>
    - <span class="pl-ent">set_fact</span>:
        <span class="pl-ent">foo</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ out.stdout }}<span class="pl-pds">"</span></span>
    - <span class="pl-ent">set_fact</span>: <span class="pl-s">bar="{{ out.stdout }}"</span>
    - <span class="pl-ent">set_fact</span>: <span class="pl-s">baz="{{ out.stdout | from_json }}"</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">var=foo</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">var=bar</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">var=baz</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">msg="{{ foo.a }}"</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">msg="{{ bar.a }}"</span>
      <span class="pl-ent">ignore_errors</span>: <span class="pl-c1">True</span>
    - <span class="pl-ent">debug</span>: <span class="pl-s">msg="{{ baz.a }}"</span>
      <span class="pl-ent">ignore_errors</span>: <span class="pl-c1">True</span></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto"><code class="notranslate">foo</code>, <code class="notranslate">bar</code>, and <code class="notranslate">baz</code> should all be interpolated into objects and behave like <code class="notranslate">foo</code> currently does.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto"><code class="notranslate">bar</code> and <code class="notranslate">baz</code> stay as unicode strings (though with different formatting), resulting in failures (and it seems that debug doesn't do <code class="notranslate">ignore_errors</code> so ansible exits before you can see <code class="notranslate">baz.a</code> but it also throws an error like the attempt for <code class="notranslate">bar.a</code>)</p>