Currently I use gitlab-ci.yml, gitlab runners to execute some various actions with ansible. I dynamically create an inventory file with a python script in a docker image, take the artifact and send to a downstream project that runs a docker image with ansible and executes a playbook on that inventory.
The inventory file has grown a bit too large and I want to break this up, then for each smaller inventory file launch docker image and ansible playbook in parallel.
I thought there should be something like foreach in gitlab-ci.yml but have not found anything like that in the documentation.
There isn’t anything like for-each. The script sections in CI configs are just Bash commands. So, you can put a Bash loop in there if you like, with a multi-line statement. However, it’s probably neater just to write a Bash script in a separate file and execute it from your .gitlab-ci.yml file.