Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

template and potentially more

ANSIBLE VERSION

$ ansible --version
ansible 2.2.1.0
config file = /opt/****/ansible.cfg
configured module search path = [ '/home/****/ansible']

CONFIGURATION

$ cat ansible.cfg | grep tmp
local_tmp = /opt/***/.ansible/tmp
remote_tmp = /opt/***/.ansible/tmp
$

OS / ENVIRONMENT

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"

SUMMARY

Files are writing to /tmp when remote_tmp and local_tmp is defined

STEPS TO REPRODUCE

- name: "{{ site }} - GENERATE JSON REPORT PER SITE STATS ONLY"
template:
src: "{{ role_path }}/templates/reports/sites/partial_table.j2"
dest: '{{ output_dir }}/reports/html/partial/{{ site }}.partial'

EXPECTED RESULTS

localhost : ok=360 changed=29 unreachable=0 failed=0

ACTUAL RESULTS

TASK [reports : *** - GENERATE JSON REPORT PER SITE STATS ONLY] ****************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "[Errno 13] Permission denied: '/tmp/tmpuv61yn'"}

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

Issue 2:
Hello,

I wanted to test ansible-2.0.0.

When I execute the command "ansible all -m ping", I have the following output.

ansible 2.0.0
config file = ansible2/conf/ansible.cfg
configured module search path = ansible-2.0.0/library
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
<ï»¿GUEST01> ESTABLISH SSH CONNECTION FOR USER: None
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "ansible2/lib/ansible/executor/process/worker.py", line 114, in run
self._shared_loader_obj,
File "ansible2/lib/ansible/executor/task_executor.py", line 119, in run
res = self._execute()
File "ansible2/lib/ansible/executor/task_executor.py", line 401, in _execute
result = self._handler.run(task_vars=variables)
File "ansible2/lib/ansible/plugins/action/normal.py", line 30, in run
results.update(self._execute_module(tmp=tmp, task_vars=task_vars))
File "ansible2/lib/ansible/plugins/action/__init__.py", line 405, in _execute_module
tmp = self._make_tmp_path()
File "ansible2/lib/ansible/plugins/action/__init__.py", line 211, in _make_tmp_path
result = self._low_level_execute_command(cmd, sudoable=False)
File "ansible2/lib/ansible/plugins/action/__init__.py", line 520, in _low_level_execute_command
rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
File "ansible2/lib/ansible/plugins/connection/ssh.py", line 603, in exec_command
raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufeff' in position 309: ordinal not in range(128)
ï»¿
GUEST01| FAILED! => {
"failed": true,
"stdout": ""

Best regards.