I would like to re-use lists of servers in multiple deployments. A simplified version of what I'm doing in some template deploy-tasks.yml
:
parameters:
- name: servers
type: object
- ${{ each server in parameters.servers }}:
- task: CopyFiles@2
inputs:
sourceFolder: ${{parameters.sourceFolder}}
targetFolder: '\\${{server}}\some-path'
cleanTargetFolder: true
Then I can use this in for example this pipeline.yml
steps:
- checkout: self
- template: deploy-tasks.yml
parameters:
servers:
# How can I define this list somewhere else?!
- server1
- server2
sourceFolder: '$(Build.SourcesDirectory)\something'
So far it works: but I would like to extract the commonly used lists of servers. So something like infra.yml
:
my-production-webservers:
- production1
- production2
And then something like (but this doesn't work):
steps:
- checkout: self
- template: deploy-tasks.yml
parameters:
servers:
!!! something that includes my-production-webservers !!!
sourceFolder: '$(Build.SourcesDirectory)\something'
Variables don't work in this case because they are string-only. What trick am I missing?