Skip to content
Snippets Groups Projects
Select Git revision
  • e47549131adde6ce98589055d1ad91969760cdcb
  • master default
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.1
  • v0.5.0
  • v0.4.0
  • v0.3.1
  • v0.3.0
  • v0.2.0
  • v0.1.0
  • v0.1.1
15 results

ansible-pre-commit

  • Clone with SSH
  • Clone with HTTPS
  • Adar Nimrod's avatar
    nimrod authored
    It's not supported anymore and PyYAML refuses to install with that
    version.
    e4754913
    History

    Ansible pre-commit hooks

    https://travis-ci.org/adarnimrod/ansible-pre-commit.svg?branch=master

    Ansible pre-commit hooks.

    • ansible-syntax-check: The hook runs ansible --syntax-check against playbooks declared.
    • ansible-vault-check: The hook verifies that files that have vault in the filename are indeed vaulted.

    Requirements

    • Pre-commit 1.2 or later.
    • Python 2.7 or 3.4 or later.

    Installation

    Add the following to your .pre-commit-config.yaml:

    - repo: https://www.shore.co.il/git/ansible-pre-commit/
      sha: v0.9.0
      hooks:
      - id: ansible-syntax-check
        files: site.yml #In case you want to specify other playbook files.
      - id: ansible-vault-check

    And in the next pre-commit will install and run the hooks. In case your roles directory isn't in the same directory as the playbook you're testing or at /etc/ansible/roles you need to declare the roles search path in ansible.cfg in the root of the repo like so:

    [defaults]
    roles_path=path/to/roles/directory:path/to/another/roles/directory

    License

    This software is licensed under the MIT license (see the LICENSE.txt file).

    Author Information

    Nimrod Adar, contact me or visit my website. Patches are welcome via git send-email. The repository is located at: https://www.shore.co.il/git/.