Thanks for this feature, I absolutely need it.  I do seem to have an issue 
using it.

I am using ansible 1.6 (devel eb090ad4a2) on RHEL 6.  When I use su with 
the copy module I get a permission denied error. 
I use a remote user to login to the server then su to another acccount. 
 This is required in my environment.  The remote user has no home directory 
so I have  remote_tmp set in my ansible.cfg to /tmp/.ansible/tmp. It 
appears that the su user doesn't have permission to .ansible/tmp created by 
the remote user.  I saw this 
issue<https://github.com/ansible/ansible/issues/2837> that 
is similar, but I could not find anything specifically for su.
Should I file a bug for this?

ansible command line:  ansible-playbook upgrade.yml -i hosts.yml -u 
remoteuser -k -S -R a_user --ask-su-pass

Output:
fatal: hostname] => failed to parse:
SUDO-SUCCESS-ulnzuflbdcdwddmombacdjeerhjdfgoy
{"msg": "Could not replace file: 
/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source to 
/opt/local-data/apphome/caches/remove_me.txt: [Errno 13] Permission denied: 
'/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source'", 
"failed": true}
Exception OSError: (2, 'No such file or directory', 
'/opt/local-data/apphome/caches/.ansible_tmpzRLO88remove_me.txt') in <bound 
method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w+b' 
at 0x7fd090bbbdb0>> ignored

fatal: [vsin3u544.svr.us.jpmchase.net] => failed to parse:
SUDO-SUCCESS-ulnzuflbdcdwddmombacdjeerhjdfgoy
{"msg": "Could not replace file: 
/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source to 
/opt/adtools-local-data/jira8/jira_home/c              aches/remove_me.txt: 
[Errno 13] Permission denied: 
'/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source'", 
"failed": true}
Exception OSError: (2, 'No such file or directory', 
'/opt/adtools-local-data/jira8/jira_home/caches/.ansible_tmpzRLO88remove_me.txt')
 in <bound                       method _TemporaryFileWrapper.__del__ of 
<closed file '<fdopen>', mode 'w+b' at 0x7fd090bbbdb0>> ignored

fatal: [vsin3u544.svr.us.jpmchase.net] => failed to parse:
SUDO-SUCCESS-ulnzuflbdcdwddmombacdjeerhjdfgoy
{"msg": "Could not replace file: 
/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source to 
/opt/adtools-local-data/jira8/jira_home/c              aches/remove_me.txt: 
[Errno 13] Permission denied: 
'/tmp/.ansible/tmp/ansible-tmp-1398820873.22-273887835083885/source'", 
"failed": true}
Exception OSError: (2, 'No such file or directory', 
'/opt/adtools-local-data/jira8/jira_home/caches/.ansible_tmpzRLO88remove_me.txt')
 in <bound                       method _TemporaryFileWrapper.__del__ of 
<closed file '<fdopen>', mode 'w+b' at 0x7fd090bbbdb0>> ignored



On Tuesday, January 21, 2014 12:03:22 PM UTC-6, James Tanner wrote:
>
> Thanks to Paul for this one!
>
> Basic usage is similar to sudo …
>
> - hosts: el6.lab.net
>   gather_facts: False
>   su: yes
>   su_user: root
>   tasks:
>     - shell: whoami
>
> or pass as command line parameters …
>
> ansible-playbook  --su --su-user=root --ask-su-pass -i inventory site.yml
>
> Begin forwarded message:
>
> *From: *Paul Durivage <[email protected] <javascript:>>
> *Subject: **[ansible] Add su support (#5694)*
> *Date: *January 20, 2014 at 8:28:44 PM EST
> *To: *ansible/ansible <[email protected] <javascript:>>
> *Reply-To: *ansible/ansible <
> reply+i-25958790-3751e6bbbad5091591e631844309f77bd2841915-1869...@reply.github.com<javascript:>
> >
>
> Continuing from PR #5325 <https://github.com/ansible/ansible/pull/5325>. 
> This reverts the revert, and is therefore known as revertception. The su 
> bug is resolved -- looks like I missed it when resolving the rebase/merge 
> conflicts. :( Also, I had missed that there was now an additional paramiko 
> lib, "paramiko_alt.py", so I've gone ahead and fixed that as well.
> ------------------------------
> You can merge this Pull Request by running 
>
>   git pull https://github.com/angstwad/ansible add-su-support-revert
>
> Or view, comment on, or merge it at:
>
>   https://github.com/ansible/ansible/pull/5694
> Commit Summary 
>    
>    - Resolve su bug in paramiko libs 
>    - Revert "Revert "Merge pull request #5325 from 
>    angstwad/add-su-support"" 
>
> File Changes 
>    
>    - *M* 
> bin/ansible<https://github.com/ansible/ansible/pull/5694/files#diff-0>(41) 
>    - *M* 
> bin/ansible-playbook<https://github.com/ansible/ansible/pull/5694/files#diff-1>(18)
>  
>    - *M* 
> lib/ansible/constants.py<https://github.com/ansible/ansible/pull/5694/files#diff-2>(6)
>  
>    - *M* 
> lib/ansible/playbook/__init__.py<https://github.com/ansible/ansible/pull/5694/files#diff-3>(85)
>  
>    - *M* 
> lib/ansible/playbook/play.py<https://github.com/ansible/ansible/pull/5694/files#diff-4>(20)
>  
>    - *M* 
> lib/ansible/playbook/task.py<https://github.com/ansible/ansible/pull/5694/files#diff-5>(20)
>  
>    - *M* 
> lib/ansible/runner/__init__.py<https://github.com/ansible/ansible/pull/5694/files#diff-6>(60)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/accelerate.py<https://github.com/ansible/ansible/pull/5694/files#diff-7>(5)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/chroot.py<https://github.com/ansible/ansible/pull/5694/files#diff-8>(5)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/fireball.py<https://github.com/ansible/ansible/pull/5694/files#diff-9>(6)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/funcd.py<https://github.com/ansible/ansible/pull/5694/files#diff-10>(7)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/jail.py<https://github.com/ansible/ansible/pull/5694/files#diff-11>(5)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/local.py<https://github.com/ansible/ansible/pull/5694/files#diff-12>(6)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/paramiko_alt.py<https://github.com/ansible/ansible/pull/5694/files#diff-13>(11)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/paramiko_ssh.py<https://github.com/ansible/ansible/pull/5694/files#diff-14>(16)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/ssh.py<https://github.com/ansible/ansible/pull/5694/files#diff-15>(33)
>  
>    - *M* 
> lib/ansible/runner/connection_plugins/ssh_old.py<https://github.com/ansible/ansible/pull/5694/files#diff-16>(31)
>  
>    - *M* 
> lib/ansible/utils/__init__.py<https://github.com/ansible/ansible/pull/5694/files#diff-17>(38)
>  
>
> Patch Links: 
>    
>    - https://github.com/ansible/ansible/pull/5694.patch 
>    - https://github.com/ansible/ansible/pull/5694.diff 
>
> —
> Reply to this email directly or view it on 
> GitHub<https://github.com/ansible/ansible/pull/5694>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2512a6c3-881d-4d76-bfd0-b94a4826fea7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to