# copy file to host not in inventory

**URL:** <https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [September 1, 2020, 3:55pm UTC](https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714 "2020-09-01T15:55:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![william.dossett](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@william.dossett](https://forum.ansible.com/u/william.dossett)\
**Post date:** [September 1, 2020, 3:55pm UTC](https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714/1 "2020-09-01T15:55:43Z")

</div>

Hi, sorry, I can’t quite get my head around the last bit of my playbook.

I have a playbook that is doing ssh key rotations - it is pretty much all working other than once it has generated the keys and used authorized\_keys module to put them on the hosts in the inventory, I want to copy the keys back to my workstation. Then it deletes the keys to cleanup. I use delegate\_to and run\_once when creating the keys, but how do I copy the keys to my workstation which is not in my inventory - I am using dynamic inventories in AWX… this isn’t something I have run into before, I will have to use a command worst case I guess, but welcome any alternative suggestions.

thanks  
Bill

---

<div class="post-metadata">

**Author:** ![william.dossett](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@william.dossett](https://forum.ansible.com/u/william.dossett)\
**Post date:** [September 1, 2020, 7:13pm UTC](https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714/2 "2020-09-01T19:13:08Z")

</div>

In the end I just used command: scp seems to work adequately

Regards

Bill

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [September 1, 2020, 7:20pm UTC](https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714/3 "2020-09-01T19:20:19Z")

</div>

In the end I just used command: scp seems to work adequately

Regards

Bill

---

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [September 2, 2020, 2:29pm UTC](https://forum.ansible.com/t/copy-file-to-host-not-in-inventory/33714/4 "2020-09-02T14:29:20Z")

</div>

I am not sure if i clearly understood your question but, you might look into this:  
[https://docs.ansible.com/ansible/latest/modules/add\_host\_module.html](https://docs.ansible.com/ansible/latest/modules/add_host_module.html)
