Skip to content

Commit a4f763e

Browse files
committed
install ansible-lint and run linting as part of verify_vm
1 parent f3046e6 commit a4f763e

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

roles/ansible-lint/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
3+
- name: Install ansible-lint at version 4.2.0
4+
pip: state=present name=ansible-lint version=4.2.0

scripts/update-vm.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ update_vm() {
6767
verify_vm() {
6868
big_step "Verifying the VM..."
6969
cd $REPO_ROOT
70+
71+
step "run ansible linting"
72+
ansible-lint --force-color
73+
7074
step "run integration tests"
7175
py.test -v --color=yes --spec spec/*.py
7276
}

site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
- hosts: localhost
1111
roles:
1212
- { role: readme, tags: "readme" }
13+
- { role: ansible-lint, tags: "ansible-lint" }
1314
- { role: testinfra, tags: "testinfra" }

spec/test_ansible_lint.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
def test_ansible_lint_is_installed_at_version_4_2_0_(host):
3+
cmd = host.run("pip3 show --disable-pip-version-check ansible-lint")
4+
assert cmd.rc is 0
5+
assert "Name: ansible-lint\nVersion: 4.2.0" in cmd.stdout
6+
7+
def test_ansible_lint_command_is_found_(host):
8+
assert host.run('which ansible-lint').rc is 0
9+
10+
def test_ansible_lint_version_command_reports_version_4_2_0_(host):
11+
assert '4.2.0' in host.run('ansible-lint --version').stdout

0 commit comments

Comments
 (0)