Our Ansible pipeline is very simple. It's a single stage with a single job, but it's an important job - this pipeline deploys our application for us.
Another key point about this pipeline is it does not restrict execution of the pipeline based on a file type. We don't really have a need to do so because once our deployment process has been defined it doesn't change much. However when a change is made, this pipeline will trigger everytime regardless of what was changed. That's OK because our deployment process won't change much and even if it does, running this pipeline will just result in the latest package being deployed, which based on our current workflow already is deployed, so nothing changes.
In future this entire Ansible pipeline will be triggered by the application pipeline after a successful new package (
httpcats.zip) is created.
This Ansible pipeline looks like this:
graph LR a[Commit] --> b b[Playbook] --> c c[AWS] --> d d[EC2] --> e e[httpcats.zip]
Playbook stage above is the only stage we have in our pipeline. Everything else is just there to demonstrate the overall flow of a change.
Let's first take a look at the
.gitlab-ci.yml file and write it.