# playbook linting

**URL:** <https://forum.ansible.com/t/playbook-linting/14629>\
**Category:** Ansible Project\
**Created:** [February 21, 2014, 10:22pm UTC](https://forum.ansible.com/t/playbook-linting/14629 "2014-02-21T22:22:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [February 21, 2014, 10:22pm UTC](https://forum.ansible.com/t/playbook-linting/14629/1 "2014-02-21T22:22:56Z")

</div>

We're growing the number of contributors, and some books are under rapid development. I'd love to be able to put a linter to the task of linting pull requests and yelling if something doesn't look right.

Any of you doing any kind of linting for playbook files?

-jlk

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [February 21, 2014, 10:27pm UTC](https://forum.ansible.com/t/playbook-linting/14629/2 "2014-02-21T22:27:51Z")

</div>

So for starters, though it’s not everything:

ansible-playbook --syntax-check exists

Part of the issue here is that it does a bit too much manual work, rather than relying on logic in the Playbook/Play classes, as it should – which has been on the list for a little while to get more back into shared code.

I generally believe this should be a task for core ansible, not a linter, and is why for instance we added a warnings feature for deprecation and some of the common YAML errors.

(i.e. extra external things shouldn’t be required, good things should be built in)

–Michael

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [February 24, 2014, 4:22pm UTC](https://forum.ansible.com/t/playbook-linting/14629/3 "2014-02-24T16:22:18Z")

</div>

Yeah, I'd be really happy if it was built into ansible!

We are aware of --syntax-check, and it helps, along with --list-hosts, but that doesn't catch attempts to make use of files that don't exist. Even that is tricky though, because you could be attempting to make use of a /generated/ file, so there would be false warnings that would have to be filtered out.

-jlk
