.gitlab-ci.yml for “ansible-lint”
So I started working with GitLab (self-hosted and gitlab.com), which led me to the CI/CD features of GitLab. When using GitLab, one can define a custom CI pipeline just by placing a
.gitlab-ci.yml file in your project (just like the
.travis.yml for GitHub). After each commit to the defined git branch, the pipeline is then executed.
Since I also work with Ansible playbooks a lot, I wanted to use
ansible-lint to check my playbooks after each commit. In addition to that, I also added a syntax check using
ansible-playbook [..] --syntax-check, as
ansible-lint will not pick up all syntax errors.
So here is my