Using Github Action to Lint Ansible

Lint Ansible playbooks using Github actions.

Remembering to run ansible-lint before you push code won’t happen. That’s why you have the computer do it for you, which means using a Github action to lint your playbooks every time you push code.

Github actions automate, customize, and execute software development work from right in our repository. You can create actions yourself, or you can leverage open-source actions created by others.

Github workflows are how you link actions together into a series of tasks. Both actions and workflows are defined by YAML files and stored in the .github directory within your repository.

Create a lint workflow

Ansible (the company) has an open-source action called Ansible Lint for GitHub Action that you will use within a workflow to lint all your Ansible code.

We have created the workflows directory using the command below:

Get hands-on with 1400+ tech skills courses.