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

**URL:** <https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303>\
**Category:** Ansible Project\
**Created:** [April 28, 2016, 3:54pm UTC](https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303 "2016-04-28T15:54:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Leo\_Huetter](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Leo\_Huetter](https://forum.ansible.com/u/John_Leo_Huetter)\
**Post date:** [April 28, 2016, 3:54pm UTC](https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303/1 "2016-04-28T15:54:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andreas\_Olsson](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@Andreas\_Olsson](https://forum.ansible.com/u/Andreas_Olsson)\
**Post date:** [April 28, 2016, 6:46pm UTC](https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303/2 "2016-04-28T18:46:26Z")

</div>

....

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

Put something like this in your ansible.cfg.

&nbsp;&nbsp;[ssh\_connection]  
&nbsp;&nbsp;control\_path = /path/to/new\_cp/ansible-ssh-%%h-%%p-%%r

See also [https://docs.ansible.com/ansible/intro\_configuration.html#control-path](https://docs.ansible.com/ansible/intro_configuration.html#control-path)

// Andreas

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [April 28, 2016, 8:13pm UTC](https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303/3 "2016-04-28T20:13:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Leo\_Huetter](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Leo\_Huetter](https://forum.ansible.com/u/John_Leo_Huetter)\
**Post date:** [April 28, 2016, 10:40pm UTC](https://forum.ansible.com/t/can-you-override-location-for-cp-folder-on-remote-hosts/21303/4 "2016-04-28T22:40:20Z")

</div>

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
