pip install ansible-lint
ansible-lint playbook.yml
pip install yamllint
yamllint .
molecule test --scenario-name default
name: Ansible Linting
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ansible-lint
run: pip install ansible-lint && ansible-lint
- name: Run yamllint
run: pip install yamllint && yamllint .
- name: Restart service (unsafe)
shell: systemctl restart nginx
- name: Restart service (safe)
ansible.builtin.service:
name: nginx
state: restarted