{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/5725","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/5725/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/5725/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/5725/events","html_url":"https://github.com/ansible/ansible/issues/5725","id":26110691,"number":5725,"title":"/tmp/ansible/ not world-writable","user":{"login":"chrisblossom","id":1595871,"avatar_url":"https://avatars.githubusercontent.com/u/1595871?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisblossom","html_url":"https://github.com/chrisblossom","followers_url":"https://api.github.com/users/chrisblossom/followers","following_url":"https://api.github.com/users/chrisblossom/following{/other_user}","gists_url":"https://api.github.com/users/chrisblossom/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisblossom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisblossom/subscriptions","organizations_url":"https://api.github.com/users/chrisblossom/orgs","repos_url":"https://api.github.com/users/chrisblossom/repos","events_url":"https://api.github.com/users/chrisblossom/events{/privacy}","received_events_url":"https://api.github.com/users/chrisblossom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/needs_info","name":"needs_info","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2014-01-22T18:20:00Z","updated_at":"2016-04-29T12:50:27Z","closed_at":"2015-07-04T03:49:41Z","body":"When initially setting \"user: root\" in a playbook, /tmp/ansible is created with directory permissions 0755 when it should be 0777 (recurse=no) because when falling back to a non-root user the following error occurs:\r\n\r\nShould be noted I'm not specifying \"-u root\" in the ansible-playbook command.\r\n\r\n```\r\nfatal: [dev] => Authentication or permission failure.  In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: mkdir -p /tmp/ansible/$USER/ansible-tmp-1390414200.76-192986604554742 && chmod a+rx /tmp/ansible/$USER/ansible-tmp-1390414200.76-192986604554742 && echo /tmp/ansible/$USER/ansible-tmp-1390414200.76-192986604554742, exited with result 1: mkdir: cannot create directory `/tmp/ansible/chris': Permission denied\r\n```\r\n\r\nExample playbook:\r\n```\r\n-   name: initial setup\r\n    hosts: all\r\n    user: root\r\n    roles:\r\n        - system\r\n        - packages\r\n        - users\r\n\r\n-   name: common setup\r\n    hosts: all\r\n    tasks:\r\n        - include: roles/users/tasks/freshshell.yml\r\n\r\n-   hosts: webservers\r\n    gather_facts: false\r\n    roles:\r\n        - php\r\n        - nginx\r\n        - web_deploy\r\n```\r\n\r\nThe solution I have done is to first setup the /tmp/ansible directory with the correct permissions:\r\n```\r\n-   name: /tmp/ansible/ directory exists with 0777 permission\r\n    file: path=/tmp/ansible/ owner=root group=root mode=0777 recurse=no state=directory\r\n    sudo: yes\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/215702323","html_url":"https://github.com/ansible/ansible/issues/5725#issuecomment-215702323","issue_url":"https://api.github.com/repos/ansible/ansible/issues/5725","id":215702323,"user":{"login":"mondherGL","id":9142978,"avatar_url":"https://avatars.githubusercontent.com/u/9142978?v=3","gravatar_id":"","url":"https://api.github.com/users/mondherGL","html_url":"https://github.com/mondherGL","followers_url":"https://api.github.com/users/mondherGL/followers","following_url":"https://api.github.com/users/mondherGL/following{/other_user}","gists_url":"https://api.github.com/users/mondherGL/gists{/gist_id}","starred_url":"https://api.github.com/users/mondherGL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mondherGL/subscriptions","organizations_url":"https://api.github.com/users/mondherGL/orgs","repos_url":"https://api.github.com/users/mondherGL/repos","events_url":"https://api.github.com/users/mondherGL/events{/privacy}","received_events_url":"https://api.github.com/users/mondherGL/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T12:50:27Z","updated_at":"2016-04-29T12:50:27Z","body":"Hi there, \r\n\r\ni want to use variables from the remote host i tried to save for example the variable JAVA_HOME existing in the remote host in a file , but the file is empty .\r\nansible can't find this variable .\r\nis there any configuration , module ... to use to manipulate the environments variables of the remote host ?\r\n\r\n---\r\n- name: java home\r\n  shell: chdir=/home  echo $JAVA_HOME > TEST.txt\r\n\r\nthe value of $JAVA_HOME is /usr/jdk1.8.0_65 when i execute \"echo $JAVA_HOME\" directly in the remote host but when i use ansible i can't catch any thing .\r\n\r\nthank you in advance ."}}