# How can I roll out files to multiple remote /home/\* directories?

**URL:** <https://forum.ansible.com/t/how-can-i-roll-out-files-to-multiple-remote-home-directories/31296>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 17, 2019, 11:18am UTC](https://forum.ansible.com/t/how-can-i-roll-out-files-to-multiple-remote-home-directories/31296 "2019-09-17T11:18:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scorp123](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@scorp123](https://forum.ansible.com/u/scorp123)\
**Post date:** [September 17, 2019, 11:18am UTC](https://forum.ansible.com/t/how-can-i-roll-out-files-to-multiple-remote-home-directories/31296/1 "2019-09-17T11:18:24Z")

</div>

I have this playbook to roll out “dot” config files:

— - hosts: linuxboxes tasks: - name: Update .\* config files in $HOME copy: src: “{{ item }}” dest: /home/user1/ owner: user1 group: user1 with\_fileglob: - /home/master/System\_Configs/Bash-Profiles/Linux/Ubuntu/User/.\*

This playbook is working OK for this one user “user1” and it does what it says: It takes all the “dot” files such as “.bashrc”, “.vimrc” and so on from that master directory and updates them with the new defaults I have defined. So all the “dot” files are the same across all hosts in the “linuxboxes” group for this one user. No problem there.

But what if I have multiple existing users? Copying & pasting that “copy:” block and redoing it for every user seems redundant and let’s be honest: it’s bad style.

How could I get ansible to loop over every /home/\* directory and copy my defaults to each existing user’s home?

I imagine I’d have to work with 2 x different “{{ item }}” loops but I am not really sure how to do it …?

I also have this little playbook below that fetches a list of remote home directories that exist (see below). How could I feed the results below (the list of remote home directories) as “dest” argument into the playbook above?

---

<div class="post-metadata">

**Author:** ![Poseidon\_Olympian](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Poseidon\_Olympian](https://forum.ansible.com/u/Poseidon_Olympian)\
**Post date:** [August 14, 2020, 8:21pm UTC](https://forum.ansible.com/t/how-can-i-roll-out-files-to-multiple-remote-home-directories/31296/2 "2020-08-14T20:21:40Z")

</div>

Hello,  
Have you able to resolved your issue?

Any idea or happy to share.

Thanks,  
Erwin
