Add Ansible-lint CI step (#4411)
* Add ansible-lint as gitlab-ci step * Fix jinja2 syntax in include_tasks that breaks ansible-lint * Use a block scalar to get around gitlab quoting/escaping rules * Run ansible-lint in verbose mode in CI
This commit is contained in:
parent
a678d1be9d
commit
d2a1ac3b0c
4 changed files with 36 additions and 1 deletions
25
.ansible-lint
Normal file
25
.ansible-lint
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
parseable: true
|
||||||
|
skip_list:
|
||||||
|
# see https://docs.ansible.com/ansible-lint/rules/default_rules.html for a list of all default rules
|
||||||
|
# The following rules throw errors.
|
||||||
|
# These either still need to be corrected in the repository and the rules re-enabled or they are skipped on purpose.
|
||||||
|
- '102'
|
||||||
|
- '103'
|
||||||
|
- '104'
|
||||||
|
- '201'
|
||||||
|
- '204'
|
||||||
|
- '206'
|
||||||
|
- '301'
|
||||||
|
- '302'
|
||||||
|
- '303'
|
||||||
|
- '305'
|
||||||
|
- '306'
|
||||||
|
- '403'
|
||||||
|
- '404'
|
||||||
|
- '502'
|
||||||
|
- '503'
|
||||||
|
- '504'
|
||||||
|
- '601'
|
||||||
|
- '602'
|
||||||
|
- '701'
|
|
@ -731,6 +731,14 @@ yamllint:
|
||||||
- yamllint .
|
- yamllint .
|
||||||
except: ['triggers', 'master']
|
except: ['triggers', 'master']
|
||||||
|
|
||||||
|
ansible-lint:
|
||||||
|
<<: *job
|
||||||
|
stage: unit-tests
|
||||||
|
# lint every yml/yaml file that looks like it contains Ansible plays
|
||||||
|
script: |-
|
||||||
|
grep -Rl '^- hosts: \|^ hosts: \|^- name: ' --include \*.yml --include \*.yaml . | xargs ansible-lint -v
|
||||||
|
except: ['triggers', 'master']
|
||||||
|
|
||||||
tox-inventory-builder:
|
tox-inventory-builder:
|
||||||
stage: unit-tests
|
stage: unit-tests
|
||||||
<<: *job
|
<<: *job
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
- not skip_downloads|default(false)
|
- not skip_downloads|default(false)
|
||||||
|
|
||||||
- name: "Download items"
|
- name: "Download items"
|
||||||
include_tasks: "download_{% if download.container %}container{% else %}file{% endif %}.yml"
|
include_tasks: "{{ include_file }}"
|
||||||
vars:
|
vars:
|
||||||
download: "{{ download_defaults | combine(item.value) }}"
|
download: "{{ download_defaults | combine(item.value) }}"
|
||||||
|
include_file: "download_{% if download.container %}container{% else %}file{% endif %}.yml"
|
||||||
with_dict: "{{ downloads }}"
|
with_dict: "{{ downloads }}"
|
||||||
when:
|
when:
|
||||||
- not skip_downloads|default(false)
|
- not skip_downloads|default(false)
|
||||||
|
|
|
@ -5,3 +5,4 @@ boto==2.9.0
|
||||||
tox
|
tox
|
||||||
dopy
|
dopy
|
||||||
PyCrypto
|
PyCrypto
|
||||||
|
ansible-lint==4.1.0
|
||||||
|
|
Loading…
Reference in a new issue