Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

Unarchive module

ANSIBLE VERSION

Both 2.1.1.0 and 2.1.0.0 on multiple Macs.

ansible 2.1.1.0
config file =
configured module search path = Default w/o overrides

also

ansible 2.1.0.0
config file =
configured module search path = Default w/o overrides

CONFIGURATION

No special settings. default config.

OS / ENVIRONMENT

Mac OS X version 10.11.6, installed via Homebrew

SUMMARY

The Unarchive module fails when trying to locally download/expand the current Ansible snapshot from GitHub. (https://github.com/ansible/ansible/archive/devel.zip The playbook in this report is downloading the equivalent archive based on the last-commited hash.)

Note that the archive can be manually downloaded and expanded on OS X.

Found this while trying to isolate a different problem with the Unarchive module related to #17009.

STEPS TO REPRODUCE

Ran this command:

ansible-playbook -vvv ~/Desktop/ansible-local-test.yaml

Complete playbook:

---

- hosts: localhost
become: no
connection: local

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

EXPECTED RESULTS

Archive downloads and unpacks.

ACTUAL RESULTS

Module failure.

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] *******************************************************************
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: joe
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `" && echo ansible-tmp-1470768855.09-223451903953364="` echo $HOME/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364 `" ) && sleep 0'
<127.0.0.1> PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpUDTEJa TO /Users/joe/.ansible/tmp/ansible-tmp-1470768855.09-223451903953364/setup
<127.0.0.1> 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/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]

TASK [Download & Unpack zip archive] *******************************************
task path: /Users/joe/Desktop/ansible-local-test.yaml:16
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: joe
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `" && echo ansible-tmp-1470768856.18-10151565722253="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253 `" ) && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `" && echo ansible-tmp-1470768856.29-136530177465962="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962 `" ) && sleep 0'
<127.0.0.1> PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmp5mz6bv TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.29-136530177465962/stat
<127.0.0.1> 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/" > /dev/null 2>&1 && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `" && echo ansible-tmp-1470768856.64-39284039925999="` echo $HOME/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999 `" ) && sleep 0'
<127.0.0.1> PUT /var/folders/f2/lskp80tm8xj5230059b53f580000gp/T/tmpwQtO7G TO /Users/joe/.ansible/tmp/ansible-tmp-1470768856.64-39284039925999/unarchive
<127.0.0.1> 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/" > /dev/null 2>&1 && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/joe/.ansible/tmp/ansible-tmp-1470768856.18-10151565722253/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {"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

Issue 2:
Issue Type:

Bug Report

Ansible Version:

1.4.5

Environment:

OSX but probably N/A

Summary:

set_var sometimes interprets JSON formatted data into an object, and other times it keeps it as a unicode string.

Steps To Reproduce:

The following test playbook demonstrates inconsistent behavior with set_var in "short" vs "extended" mode.

---
- name: test
hosts: localhost
gather_facts: False
tasks:
- local_action: 'command echo ''{"a": 1, "b": 2}'''
register: out
- set_fact:
foo: "{{ out.stdout }}"
- set_fact: bar="{{ out.stdout }}"
- set_fact: baz="{{ out.stdout | from_json }}"
- debug: var=foo
- debug: var=bar
- debug: var=baz
- debug: msg="{{ foo.a }}"
- debug: msg="{{ bar.a }}"
ignore_errors: True
- debug: msg="{{ baz.a }}"
ignore_errors: True

Expected Results:

foo, bar, and baz should all be interpolated into objects and behave like foo currently does.

Actual Results:

bar and baz stay as unicode strings (though with different formatting), resulting in failures (and it seems that debug doesn't do ignore_errors so ansible exits before you can see baz.a but it also throws an error like the attempt for bar.a)