0

I have a massive amount (100+) different hosts that i can deploy my product to. I have to be able to deploy the product to each one of them separately. Creating different tasks for all of these with only different host seems unmanagable. It would look something like:

deploy_to_host1:
  stage: deploy
  image: image
  script:
    - do deployment to host 1 here

deploy_to_host2:
  stage: deploy
  image: image
  script:
    - do deployment to host 2 here

etc

One other possibility is to have one task and while running the task i can add variable host=hostname.

deploy_to_host:
  stage: deploy
  image: image
  script:
    - do deployment to $host variable here

From code perspective a lot cleaner, but this is also unmanageable because i cant memorize all different possible hostnames. What is the recommended solution for this in GitLab CI?

user1985273
  • 1,817
  • 15
  • 50
  • 85
  • Could you obtain dynamically the list of the hosts (from a config management tool like puppet or chef for example ?) – Nicolas Pepinster Jan 10 '20 at 14:08
  • I think using [YAML Anchors](https://docs.gitlab.com/ee/ci/yaml/#anchors) can be helpful. For more information, check this answer https://stackoverflow.com/a/59568106/7781704 – Amir Dadkhah Jan 10 '20 at 14:25

0 Answers0