Skip to content

Commit

Permalink
Specify virtual env path when using a virtual env. (#564)
Browse files Browse the repository at this point in the history
Co-authored-by: Bastien Wirtz <[email protected]>
  • Loading branch information
bastienwirtz and Bastien Wirtz authored Jan 12, 2024
1 parent f483e16 commit 5e7c67c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Core
consul_debug: false
is_virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') | default('', true) }}"
virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') | default('') }}"
consul_install_dependencies: true

### Package
Expand Down
5 changes: 3 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
vars:
ansible_become: false
run_once: true
when: not is_virtualenv or is_virtualenv == None
when: virtualenv == ""

- name: Install netaddr dependency on controlling host (virtualenv)
ansible.builtin.pip:
name: netaddr
virtualenv: "{{ virtualenv }}"
delegate_to: 127.0.0.1
become: false
vars:
ansible_become: false
run_once: true
when: is_virtualenv is defined
when: virtualenv != ""

- name: Include checks/asserts
ansible.builtin.import_tasks:
Expand Down

0 comments on commit 5e7c67c

Please sign in to comment.