---
- name: "install needed packages"
  become: yes
  apt:
      name: "{{ item }}"
      state: present
  with_items:
      - postgresql
      - aptitude
      - python3-pip

- name: "install odoo repo key"
  become: yes
  apt_key:
      url: "https://nightly.odoo.com/odoo.key"
      state: present

- name: "enable odoo PPA"
  become: yes
  apt_repository:
      repo: deb http://nightly.odoo.com/11.0/nightly/deb/ ./
      state: present
  notify: update package cache

- name: "install additional python packages"
  become: yes
  pip:
      name: "{{ item }}"
      executable: pip3
  with_items:
      - num2words
      - vobject
      - qrcode

- name: "install odoo package"
  become: yes
  apt:
      name: odoo
      state: present

- name: "enable proxy mode"
  become: yes
  ini_file:
      path: /etc/odoo/odoo.conf
      section: "options"
      option: "proxy_mode"
      value: True
      backup: yes
  notify: restart odoo
