# have one src file to many dest in single file copy block?

**URL:** <https://forum.ansible.com/t/have-one-src-file-to-many-dest-in-single-file-copy-block/25488>\
**Category:** Ansible Project\
**Created:** [September 14, 2017, 7:56pm UTC](https://forum.ansible.com/t/have-one-src-file-to-many-dest-in-single-file-copy-block/25488 "2017-09-14T19:56:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daddyocruzer](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@daddyocruzer](https://forum.ansible.com/u/daddyocruzer)\
**Post date:** [September 14, 2017, 7:56pm UTC](https://forum.ansible.com/t/have-one-src-file-to-many-dest-in-single-file-copy-block/25488/1 "2017-09-14T19:56:51Z")

</div>

I have this for copying the same (new) banner file to each locations - is there a way for ‘dest’ to expand to include each location in a single line so I can have just one ‘copy’ block?

tasks: - copy: src : ~/new-banner-2017.txt \<----- same file dest: /etc/motd owner: root group: root mode: 0644 - copy: src: ~/new-banner-2017.txt \<----- same file dest: /etc/issue owner: root group: root mode: 0644

Is there a way to have ‘dest’ cover both destinations, like an array or list of some sort? ( dest: “/etc/issue , /etc/motd” ) ?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 14, 2017, 9:03pm UTC](https://forum.ansible.com/t/have-one-src-file-to-many-dest-in-single-file-copy-block/25488/2 "2017-09-14T21:03:22Z")

</div>

No, but you can use with\_items, you will only have one copy in your code but it will expand to as many tasks as you have in with\_items.

---

<div class="post-metadata">

**Author:** ![daddyocruzer](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@daddyocruzer](https://forum.ansible.com/u/daddyocruzer)\
**Post date:** [September 14, 2017, 10:26pm UTC](https://forum.ansible.com/t/have-one-src-file-to-many-dest-in-single-file-copy-block/25488/3 "2017-09-14T22:26:52Z")

</div>

OK, this ended up being how I did it:

- copy  
…  
dest: “{{ item }}”  
…  
with\_items:
- ‘/etc/motd’
- ‘/etc/issue’
