Force ansible remote directory to /tmp

My ansible runs really slowly, I’ve looked at various things, and one thing I haven’t eliminated yet is that ansible runs in my NFS directory as it ssh’es around. I’ve run ansible before and its performance is fine usually – but the biggest difference in this setup is slow NFS and extra latency to the remote systems.

I’m in the process of trying the following and I think it is not working. I think sudo grabs the /tmp and then it runs /bin/sh as me.

[defaults]
executable=cd /tmp \&\& /bin/sh

Is there a better way?

(I’ve attached strace to the remote sshd while running – the biggest hit visually watching the system calls scroll by is python loading for every ansible statement. So I want to move $CWD to /tmp to minimize python reading the $CWD as it searches its paths – which is fairly slow NFS.)

From the docs:

https://docs.ansible.com/ansible/latest/plugins/shell/sh.html?highlight=ansible_remote_tmp

you can add this to your ansible.cfg
[defaults]
remote_tmp = /tmp

or you can use and env var or even set it per group/host via
ansible_remote_tmp var

I already have remotr_tmp set. That doesn't change the working / current directory away from the remote ssh user's home directory as far as I can tell by watching strace.

Nevermind - I just discovered mitogen! WOW – what an improvement!

Rich