How do you run `ansible-lint` with a profile and fix issues automatically?
IntermediateProductionRapid-Fire Commands
Answer
ansible-lint --profile production playbooks/ roles/
ansible-lint --fix roles/nginx # rewrites fixable issues (FQCN, yaml formatting)
ansible-lint -f sarif > lint.sarif # for code scanning UIs
ansible-lint --list-rules
Review --fix changes before committing; it reformats YAML and can touch many files at once.
More on Rapid-Fire Commands
How do you see which hosts a playbook would run against, without running it?BeginnerHow do you list the tasks and tags a playbook contains?BeginnerHow do you inspect the inventory structure and a host's variables?BeginnerHow do you restart a service on a group with an ad-hoc command?BeginnerHow do you resume a playbook from a specific task or step through it?BeginnerHow do you re-run a playbook only on the hosts that failed?Intermediate