From 9d311793a36ec1c49c70be3d2d8a6851c7dccdfb Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 10 Nov 2023 13:23:35 -0500 Subject: [PATCH] add ansible_lint_vers to specify which release to install add linting on the desired directory; using chdir for testing --- venv.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/venv.yml b/venv.yml index d52cf0c..64ea5af 100644 --- a/venv.yml +++ b/venv.yml @@ -5,6 +5,7 @@ vars: + ansible_lint_vers : "6.13.1" ansible_lint_venv : /tmp/ansible-lint-venv git_repo_to_lint : https://gitea.thezengarden.net/chris/ansible-lint-poc.git lint_work_dir : /tmp/lint_repository @@ -25,7 +26,7 @@ state: present - - name: Disable CRB repository as it is no longer neded + - name: Disable CRB repository as it is no longer needed ansible.builtin.command: cmd: dnf config-manager --disable crb changed_when: true @@ -33,7 +34,7 @@ - name: Create VirtualEnv and Install ansible-lint ansible.builtin.pip: - name: ansible-lint==6.22.0 + name: "ansible-lint=={{ ansible_lint_vers }}" virtualenv: "{{ ansible_lint_venv }}" virtualenv_python: python3.9 @@ -74,9 +75,19 @@ version: main - - name: Clone target repository into - ansible.builtin.pause: - seconds: 30 + - name: Test Ansible Lint - Playbooks/Roles + ansible.builtin.command: + cmd: "{{ ansible_lint_venv }}/bin/ansible-lint --nocolor --format json" + chdir: "{{ lint_work_dir }}" + ignore_errors: true + changed_when: false + register: r_lint_output + + + - name: Debug r_lint_output + ansible.builtin.debug: + verbosity: 1 + var: r_lint_output['stdout'] - name: Cleanup repository destination