Skip to content

Commit 4e6c7a6

Browse files
committed
Install odoo package if not installed in virtualenv
1 parent 276c88e commit 4e6c7a6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tasks/main.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,19 @@
119119
state: link
120120
when: odoo_role_odoo_version < "12.0" and ansible_distribution == "Ubuntu" and not ansible_distribution_version >= "18.04"
121121

122+
- name: Check if Odoo is already installed in virtualenv
123+
become: true
124+
become_user: "{{ odoo_role_odoo_user }}"
125+
ansible.builtin.shell: >
126+
{{ odoo_role_odoo_python_path }} -m pip list | grep odoo
127+
register: odoo_package_is_installed
128+
failed_when: odoo_package_is_installed.rc not in [0,1]
129+
122130
- name: Install Odoo
123131
become: true
124132
become_user: "{{ odoo_role_odoo_user }}"
125133
shell: "cd {{ odoo_role_odoo_path }} && {{ odoo_role_odoo_python_path }} setup.py install"
126-
when: odoo_role_desired_tar_download.changed or odoo_role_desired_git_download.changed
134+
when: odoo_role_desired_tar_download.changed or odoo_role_desired_git_download.changed or odoo_package_is_installed.stdout == ''
127135

128136
- name: Populate community db modules
129137
set_fact:

0 commit comments

Comments
 (0)