Best practices to reuse existing projects

Hi all,

I have standalone projects which perform specific actions when they run their CI/CD, like creating DB’s, computes, etc. Now I would like to be able to use these across my other projects, so I would think we could use submodules. However I would like to be able to launch the pipelines for these projects as inclusive jobs within this other project. I know by setting up as submodules, I would have the projects checked out, but I am not sure how I can launch the execution of each of these .gitlab-ci.yml’s as if they were all included as part of the main .gitlab-ci.yml.

My setup would be something like below, where when a pipeline is run, using the main CI/CD, it should also be able to kick off jobs for submodule1, submodule2 as part of main pipeline P1 as an inclusive job and not an external pipeline

.gitlab-ci.yml ( Main CI/CD)
submodule1@123
submodule1@123/.gitlab-ci.yml
submodule2@321
submodule2@321/.gitlab-ci.yml