What is the ansible-lint tool?
> ansible-lint checks playbooks for practices and behavior that could potentially be improved.
[Ansible-Lint](/articles/ansible-lint) is a command-line tool for linting playbooks, roles, and collections aimed toward any Ansible users. Its main goal is to promote proven practices, patterns, and behaviors while avoiding common pitfalls that can easily lead to bugs or make code harder to maintain.
Links
- ansible-lint https://ansible-lint.readthedocs.io/
- Homebrew https://brew.sh/
Installation in macOS
Let's install the ansible-lint tool in macOS using the Homebrew package manager. I suppose the Homebrew is already installed using the Homebrew https://brew.sh/ website. The brew tool works on macOS Intel and Silicon (M1, M2, M1Pro, M2Pro, M1Max, M2Max, M1Ultra, M2Ultra).
before
``bash
% ansible-lint
zsh: command not found: ansible-lint
% brew search ansible-lint
==> Formulae
ansible-lint ansible ✔
==> Casks
ansible-dk
`
installation command
The installation command downloads the required files and dependencies (sqlite, ansible, black, pygments and yamllint) and install them in our system.
`bash
% brew install ansible-lint
`
execution
``bash
% brew install ansible-lint
==> Fetching dependencies for ansible-lint: sqlite, ansible, black, pygments and yamllint
==> Fetching sqlite
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.41.0
Already downloaded: /Users/lberton/Library/Caches/Homebrew/downloads/19202efbc509ad22113d571d4b2aaa86fdbf2e3c5299fde49c6a0bb41d9b0328--sqlite-3.41.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:72073c161c9ee425437a
Already downloaded: /Users/lberton/Library/Caches/Homebrew/downloads/c1511ff7e302362a8736c0964fb633597bee677c78599790eb905eb3e5ff27f4--sqlite--3.41.0.arm64_ventura.bottle.tar.gz
==> Fetching ansible
==> Downloading https://ghcr.io/v2/homebrew/core/ansible/manifests/7.3.0
Already downloaded: /Users/lberton/Library/Caches/Homebrew/downloads/8abde3dff30d5f40dee39f30248a558f50232653b325325b924a206bf6cfb3ad--ansible-7.3.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/ansible/blobs/sha256:11869f8ad5ad1d3ba34
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:1186
######################################################################## 100.0%
==> Fetching black
==> Downloading https://ghcr.io/v2/homebre