Dealerdirect: Ansible CI Docker Container
This is simple Docker container containing all tools for testing a Ansible codebase.
We use this container in conjunction with BitBucket Pipelines to ensure code quality.
Note: This container is not used for role testing, but mainly for syntax / code style insurance
This container is based the latest Debian Jessie docker image.
Tools present in the container:
- Ansible: For checking syntax on roles & playbooks
- YamlLint: Linting / style checking YAML files
- Flake8: For Python PEP8 style guide enforcement on custom Ansible modules & plugins
- RuboCop: For linting Vagrant files
- JSONLint: For checking JSON files within the project
BitBucket Pipelines Example
This is an example
bitbucket-pipelines.yml. Place this file in the root of your project.
--- image: dealerdirect/ci-ansible pipelines: default: - step: script: - rubocop - flake8 . - find . -type f -name "*.json" -print0 | xargs -0 -n1 jsonlint -c -q - find . -type f -name "*.yml" -print0 | xargs -0 -n1 yamllint - find ./roles/*/* -type d -maxdepth 0 -print0 | xargs -0 -n1 ansible-lint -v - find ./playbooks/* -name "*.yml" -type f -print0 | xargs -0 -n1 ansible-lint -v - find ./playbooks/* -name "*.yml" -type f -print0 | xargs -0 -n1 ansible-playbook -i /etc/ansible/hosts --syntax-check
In order to tweak the rulesets of the checks, please check the documentation of each tool.
Most of these tools have support for placing a configuration file in the root of your project. (e.g. a
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We've set up a separate document for our contribution guidelines.
Thank you for being involved! :heart_eyes:
Authors & Contributors
The original idea and setup of this repository is by Franck Nijhof, employee @ Dealerdirect.
For a full list off all author and/or contributors, please check this page.
Would you like to work @ Dealerdirect?
Dealerdirect is always on the looking for energetic and hard working developers and devops engineers.
Interested in working at Dealerdirect? Then please be sure to check out our vacancies.
Did not find a matching vacancy? Just get in touch!
The MIT License (MIT)
Copyright (c) 2016 Dealerdirect B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN