Skip to content

Commit

Permalink
Merge pull request #78 from coopdevs/use-pyenv
Browse files Browse the repository at this point in the history
Use Avanon Pyenv community role to install Pyenv
  • Loading branch information
cesarlr authored Jun 4, 2020
2 parents b881514 + e5f0130 commit 0982224
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 38 deletions.
5 changes: 4 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ odoo_role_odoo_user: odoo
odoo_role_odoo_group: odoo

# VirtualEnv vars
odoo_role_odoo_venv_path: /opt/.odoo_venv
pyenv_odoo_python_version: "3.7.7"
pyenv_global_python_version: "3.8.2"
pyenv_venv_name: "odoo"
odoo_role_odoo_venv_path: "/home/{{ odoo_role_odoo_user }}/pyenv/versions/{{ pyenv_venv_name }}/"

# Odoo releases download strategy: tar or git
odoo_role_download_strategy: tar
Expand Down
6 changes: 5 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ galaxy_info:
- name: Ubuntu
versions:
- xenial
- bionic
- focal

galaxy_tags:
- odoo
Expand All @@ -23,4 +25,6 @@ galaxy_info:
- erp
- python

dependencies: []
dependencies:
- name: avanov.pyenv
version: 1.1.0
9 changes: 6 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
deb: "https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.{{ ansible_distribution_release }}_amd64.deb"
when: wkhtmltox_installed.rc == 1

- import_tasks: virtualenv.yml
- import_tasks: pyenv.yml
become: yes

- name: Create Odoo directories
become: yes
Expand Down Expand Up @@ -78,22 +79,24 @@
- nodejs
- npm
state: present
when: odoo_role_odoo_version < "12.0"

- name: Install Less CSS via nodejs
become: yes
npm:
name: less
version: 2.7.2
global: yes
when: odoo_role_odoo_version < "12.0"

# This link is needed in Ubuntu 16.04 and in Ubuntu 18.04 raise and error.
# This link is needed in Ubuntu 16.04 and in Ubuntu 18.04 raise an error.
- name: Create node symlink
become: yes
file:
src: /usr/bin/nodejs
dest: /usr/bin/node
state: link
when: ansible_distribution == "Ubuntu" and not ansible_distribution_version == "18.04"
when: odoo_role_odoo_version < "12.0" and ansible_distribution == "Ubuntu" and not ansible_distribution_version >= "18.04"

- name: Install Odoo
become: yes
Expand Down
14 changes: 14 additions & 0 deletions tasks/pyenv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Install Pyenv
import_role:
name: avanov.pyenv
vars:
pyenv_path: "/home/{{ odoo_role_odoo_user }}/pyenv/"
pyenv_owner: "{{ odoo_role_odoo_user }}"
pyenv_global: "{{ pyenv_global_python_version }}"
pyenv_python_versions:
- "{{ pyenv_odoo_python_version }}"
- "{{ pyenv_global_python_version }}"
pyenv_virtualenvs:
- venv_name: "{{ pyenv_venv_name }}"
py_version: "{{ pyenv_odoo_python_version }}"
33 changes: 0 additions & 33 deletions tasks/virtualenv.yml

This file was deleted.

0 comments on commit 0982224

Please # to comment.