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

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” ) ?

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.

OK, this ended up being how I did it:

  • copy

    dest: “{{ item }}”

    with_items:
  • ‘/etc/motd’
  • ‘/etc/issue’