From b3c406b2f4ef9a8a563616b4ed48c72c0efdbc8f Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 10 Nov 2023 12:32:00 -0500 Subject: [PATCH] add lint venv dir var ansible-lint references updated to call from venv bin dir --- venv.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/venv.yml b/venv.yml index 7070c25..a9a8f3f 100644 --- a/venv.yml +++ b/venv.yml @@ -5,6 +5,10 @@ gather_facts: true + vars: + ansible_lint_venv_dir: /tmp/ansible-lint-venv + + tasks: - name: Ensure virtualenv command is present ansible.builtin.package: @@ -15,18 +19,23 @@ - name: Create VirtualEnv and Install ansible-lint ansible.builtin.pip: name: ansible-lint==6.22.0 - virtualenv: /tmp/ansible-lint-venv - virtualenv_python: python3.6 + virtualenv: "{{ ansible_lint_venv_dir }}" + + + # - name: Source venv + # ansible.builtin.shell: + # cmd: "source {{ ansible_lint_venv_dir }}/bin/activate" + # changed_when: false - name: Test Ansible Lint - Version - ansible.builtin.command: /tmp/ansible-lint-venv/bin/ansible-lint --nocolor --version + ansible.builtin.command: "{{ ansible_lint_venv_dir }}/bin/ansible-lint --nocolor --version" register: r_lint_version changed_when: false - name: Test Ansible Lint - Help - ansible.builtin.command: /tmp/ansible-lint-venv/bin/ansible-lint --nocolor --help + ansible.builtin.command: "{{ ansible_lint_venv_dir }}/bin/ansible-lint --nocolor --help" register: r_lint_help changed_when: false @@ -34,3 +43,4 @@ - name: Show ansible-lint infos ansible.builtin.debug: msg: "ansible-lint version: {{ r_lint_version['stdout'] }}" + verbosity: 1