You have two reasonable approaches that you can try here to reduce recurrence.
You can have a separate shared-files directory, which will be located as a sibling in your role folders as follows:
play.yml roles/ web/ tasks/ files/ other-multiple-files role-2/ tasks/ files/ other-multiple-files role-3/ tasks/ role-4/ tasks/ shared-files/ common-1 common-2
Then you refer to this in tasks with the relative location of the file from which the role / files folder will be:
- name: copy common-1 copy: src: ../../common-1 dest: /path/to/dest/common-1 - name: copy role specific file src: other-multiple-files dest: /path/to/dest/other-multiple-files
Or alternatively, to use a relative folder path, you could symbolize things like this:
play.yml roles/ web/ tasks/ files/ common-1 -> ../../common-1 common-2 -> ../../common-2 other-multiple-files role-2/ tasks/ files/ common-1 -> ../../common-1 common-2 -> ../../common-2 other-multiple-files role-3/ tasks/ files/ common-2 -> ../../common-2 role-4/ tasks/ files/ common-1 -> ../../common-1 shared-files/ common-1 common-2
And you can refer to the file as if it were in the role / files directory directly:
- name: copy common-1 copy: src: common-1 dest: /path/to/dest/common-1 - name: copy role specific file src: other-multiple-files dest: /path/to/dest/other-multiple-files
source share