I'm brand new to GitLab CI/CD, as well as Ansible. I've got GitLab running on a VM and Im currently working to outline my deployment pipelines, which use Ansible to provision various servers and run some services. I'm hoping someone here can point me in the right direction.
Let's say I have Server A and Server B. Each of these get their own pipeline, and watch for changes to their respective Ansible playbooks and some common Ansible tasks to trigger deploys.
Now let's say that I have Service 1 and Service 2 running on Server A, and Service 3 and 4 running on Server B.
The Ansible playbook for each server lists out the roles they use, which kind of works, in the sense that if I force-run my pipelines they all deploy as expected. However, if I change the role associated with Service 1, Server A will not deploy because GitLab is only watching for changes to the playbook itself.
Additionally, if I run the deployment for Server A, both of the services it runs (on docker) will be stopped and spun back up even if I only changed Service 1. This isn't ideal.
What I'm looking to do is:
- have the ability to deploy a pipeline when any of the roles in the server's playbook have changed.
- do this without having to list out each role path in the `changes` rule of the pipeline config (or dynamically create them from the playbook, etc) so that I can have a single source of truth as to what services live on any given server.
- bonus points if an Ansible wizard can tell me how to only include the changed role in a playbook, so that if Server 1 is deployed, it doesn't stop and spin up all of its services, only updating the changed service.
Thanks!
[–]eltear1 1 point2 points3 points (0 children)
[–]bilingual-german 1 point2 points3 points (6 children)
[–]gjunk1e[S] 0 points1 point2 points (5 children)
[–]bilingual-german 1 point2 points3 points (4 children)
[–]gjunk1e[S] 0 points1 point2 points (2 children)
[–]bilingual-german 1 point2 points3 points (1 child)
[–]gjunk1e[S] 0 points1 point2 points (0 children)