{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/17901","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/17901/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/17901/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/17901/events","html_url":"https://github.com/ansible/ansible/issues/17901","id":180984400,"number":17901,"title":"Binary content gets mangled in a playbook","user":{"login":"agaffney","id":825875,"avatar_url":"https://avatars.githubusercontent.com/u/825875?v=3","gravatar_id":"","url":"https://api.github.com/users/agaffney","html_url":"https://github.com/agaffney","followers_url":"https://api.github.com/users/agaffney/followers","following_url":"https://api.github.com/users/agaffney/following{/other_user}","gists_url":"https://api.github.com/users/agaffney/gists{/gist_id}","starred_url":"https://api.github.com/users/agaffney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agaffney/subscriptions","organizations_url":"https://api.github.com/users/agaffney/orgs","repos_url":"https://api.github.com/users/agaffney/repos","events_url":"https://api.github.com/users/agaffney/events{/privacy}","received_events_url":"https://api.github.com/users/agaffney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-04T19:36:22Z","updated_at":"2016-10-04T19:36:22Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n`ansible-playbook` and Jinja2\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.2.0\r\n```\r\n\r\n##### CONFIGURATION\r\nN/A\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\nWhen trying to grab the content of a \"binary\" file and transfer it using Ansible, the content gets mangled. It appears as if this is due to UTF8-ification of the data.\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\nPlaybook:\r\n\r\n```\r\n- hosts: localhost\r\n  gather_facts: no\r\n  tasks:\r\n  - command: cat /tmp/ansible_test/random.file\r\n    register: foo\r\n  - copy:\r\n      dest: /tmp/ansible_test/random2.file\r\n      content: \"{{ foo.stdout }}\"\r\n```\r\n\r\nCreate file with binary junk:\r\n\r\n```\r\n$ dd if=/dev/urandom of=random.file bs=1 count=10\r\n```\r\n\r\nResult:\r\n\r\n```\r\n$ ls -l random*file\r\n-rw-rw-r-- 1 agaffney agaffney 14 Oct  4 13:14 random2.file\r\n-rw-rw-r-- 1 agaffney agaffney 10 Oct  4 13:14 random.file\r\n\r\n$ hexdump -C random.file\r\n00000000  7e f4 9c 3b 6e ef 55 2e  5e d6                    |~..;n.U.^.|\r\n0000000a\r\n\r\n$ hexdump -C random2.file\r\n00000000  7e c3 b4 c2 9c 3b 6e c3  af 55 2e 5e c3 96        |~....;n..U.^..|\r\n0000000e\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nIdentical files\r\n\r\n##### ACTUAL RESULTS\r\nNon-identical files"}}
{"actor":{"display_login":"agaffney"}}