Can you override location for "cp" folder on remote hosts?

Hello,

Our UNIX administrators are trying to root lock all home directories (/export/home/), including the user which Ansible uses (username: test).

As such, when I send an Ansible command it fails due to the inability to create this “cp” folder under $HOME/.ansible.

I have set remote_tmp to some other directory but this seems to not have anything to do with this “cp” folder.

Is there a way to overrride where this “cp” directory goes?

Note: I am not doing anything with sudo, just basic central host → remote host connection.

Example:

central:/app/test/ansible> /usr/bin/ansible-playbook -i env.poc playbooks/test_connection.yml -vvv

PLAY [test] *****************************************************************

TASK: [common | check_in] *****************************************************
fatal: [remoteA] => Could not make dir /export/home/test/.ansible/cp: [Errno 13] Permission denied: ‘/export/home/test/.ansible’
fatal: [remoteB] => Could not make dir /export/home/test/.ansible/cp: [Errno 13] Permission denied: ‘/export/home/test/.ansible’

Thanks,
John

....

Is there a way to overrride where this "cp" directory goes?

Put something like this in your ansible.cfg.

  [ssh_connection]
  control_path = /path/to/new_cp/ansible-ssh-%%h-%%p-%%r

See also https://docs.ansible.com/ansible/intro_configuration.html#control-path

// Andreas

You are describing how to use a different control-path, which is on
the host machine, i.e. the machine where ansible is called.

I think John wants to use a different folder on the target host, i.e.
the host on which the changes are applied to...

Johannes

Correct! On the remote side.

I tried updating the $HOME environment variable once it goes over there but realized I was down a rat hole and didn’t want to break other stuff.

I saw on a previous post that this is HARD CODED in the Ansible code.

John