Code Monkey home page Code Monkey logo

ansible-odoo's Introduction

Odoo Build Status

Ansible role to install Odoo from a Git or Mercurial repository, or from pip, and configure it.

This role supports three types of installation:

  • standard: install the Odoo dependencies from APT repositories and the Odoo project from a Git/Hg repository. Odoo is configured with Ansible options (odoo_config_* ones).

  • pip: install Odoo and its dependencies (modules and Python packages) from a pip requirements.txt file. Odoo is configured with Ansible options (odoo_config_* ones).

  • buildout: build the Odoo project from a Git/Hg repository containing a Buildout configuration file based on the anybox.recipe.odoo recipe. Odoo and its dependencies are then installed and executed inside a Python virtual environment. The configuration part is also managed by Buildout (odoo_config_* options are not used excepting the odoo_config_db_* ones for PostgreSQL related tasks).

Minimum Ansible Version: 2.4

Supported versions and systems

System / Odoo 8.0 9.0 10.0 11.0
Debian 8 yes yes yes -
Debian 9 yes yes yes yes
Ubuntu 14.04 yes yes yes -
Ubuntu 16.04 yes yes yes yes

Example (Playbook)

odoo_install_type: standard (default)

Standard installation (assuming that PostgreSQL is installed and running on the same host):

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_version: 11.0
      odoo_config_admin_passwd: SuPerPassWorD

With the standard installation type you configure Odoo with the available odoo_config_* options.

Standard installation but with PostgreSQL installed on a remote host (and available from your Ansible inventory):

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_version: 11.0
      odoo_config_admin_passwd: SuPerPassWorD
      odoo_config_db_host: pg_server
      odoo_config_db_user: odoo
      odoo_config_db_passwd: PaSsWoRd

Standard installation from a personnal Git repository such as your repository looks like this:

REPO/
├── server              # could be a sub-repository of https://github.com/odoo/odoo
├── addons_oca_web      # another sub-repository (https://github.com/OCA/web here)
├── addons_oca_connector    # yet another sub-repository (https://github.com/OCA/connector)
└── addons              # custom modules

Here we set some options required by the connector framework:

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_version: 11.0
      odoo_repo_type: git
      odoo_repo_url: https://SERVER/REPO
      odoo_repo_rev: master
      odoo_repo_dest: "/home/{{ odoo_user }}/odoo"
      odoo_init_env:
        ODOO_CONNECTOR_CHANNELS: root:2
      odoo_config_admin_passwd: SuPerPassWorD
      odoo_config_addons_path:
        - "/home/{{ odoo_user }}/odoo/server/openerp/addons"
        - "/home/{{ odoo_user }}/odoo/server/addons"
        - "/home/{{ odoo_user }}/odoo/addons_oca_web"
        - "/home/{{ odoo_user }}/odoo/addons_oca_connector"
        - "/home/{{ odoo_user }}/odoo/addons"
      odoo_config_server_wide_modules: web,web_kanban,connector
      odoo_config_workers: 8

odoo_install_type: pip

Pip installation (assuming that PostgreSQL is installed and running on the same host). We need to ensure that the environment variable LC_ALL is used if Odoo version 11 is to be used:

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_install_type: pip
      odoo_version: 11.0
      odoo_pip_requirements_url: https://raw.githubusercontent.com/OCA/sample-oca-pip-requirements/11.0/requirements.txt
      odoo_config_admin_passwd: SuPerPassWorD
  environment:
    LC_ALL: en_US.UTF-8

odoo_install_type: buildout

With a Buildout installation type, Odoo is installed and configured directly by Buildout:

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_install_type: buildout
      odoo_version: 11.0
      odoo_repo_type: git
      odoo_repo_url: https://github.com/osiell/odoo-buildout-example.git
      odoo_repo_rev: "{{ odoo_version }}"
      odoo_repo_dest: "/home/{{ odoo_user }}/odoo"

The same but with PostgreSQL installed on a remote host (and available from your Ansible inventory):

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_install_type: buildout
      odoo_version: 11.0
      odoo_repo_type: git
      odoo_repo_url: https://github.com/osiell/odoo-buildout-example.git
      odoo_repo_rev: "{{ odoo_version }}"
      odoo_repo_dest: "/home/{{ odoo_user }}/odoo"
      odoo_config_db_host: pg_server
      odoo_config_db_user: odoo
      odoo_config_db_passwd: PaSsWoRd

By default Ansible is looking for a bootstrap.py script and a buildout.cfg file at the root of the cloned repository to call Buildout, but you can change that to point to your own files. Assuming your repository looks like this:

REPO/
├── addons              # custom modules
├── bin
│   └── bootstrap.py
├── builtout.cfg
├── builtout.dev.cfg
├── builtout.prod.cfg
└── builtout.test.cfg

We just set the relevant options to tell Ansible the files to use with the odoo_buildout_* options:

- name: Odoo
  hosts: odoo_server
  become: yes
  roles:
    - role: odoo
      odoo_install_type: buildout
      odoo_version: 11.0
      odoo_repo_type: git
      odoo_repo_url: https://SERVER/REPO
      odoo_repo_rev: master
      odoo_repo_dest: "/home/{{ odoo_user }}/odoo"
      odoo_buildout_bootstrap_path: "/home/{{ odoo_user }}/odoo/bin/bootstrap.py"
      odoo_buildout_config_path: "/home/{{ odoo_user }}/odoo/buildout.prod.cfg"

Variables

See the defaults/main.yml file.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.

Credits

Contributors

  • Sébastien Alix
  • Jordi Ballester Alomar

Do not contact contributors directly about support or help with technical issues.

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.

Licence

This project is licensed under the terms of the GPLv3 license.

ansible-odoo's People

Contributors

djowett avatar ehansejoerg avatar jordibforgeflow avatar mmequignon avatar ncharlot avatar pedrobaeza avatar sebalix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-odoo's Issues

Failing to download wkhtmltox

Hello,

I am using vagrant with ubuntu xenial and I am trying to install Odoo 8. When I get to the "Download wkhtmltox" step it fails with a 404. The file wkhtmltox-0.12.1_linux-xenial-amd64.deb does not exist.

I believe something is broken with the odoo_wkhtmltox_urls, since there is not a package that uses ansible_distribution_name for the xenial case. I am not sure if the generic package could work.

On the repo readme file it says that Odoo 8, 9 and 10 works for Ubuntu 16.04. Any insight on how to make it work please?

Thank you.

No log with systemd

Hi,

I was wondering why I get no log on Stretch...

I'm a bit confused about what's in default/main.yml and odoo-standard.service template.

I guess odoo-standard.service is the template for systemd.
It's prepared to use odoo_logfile if defined:

ExecStart={{ odoo_rootdir }}/odoo-bin{{ odoo_logfile and ' --logfile %s' % odoo_logfile }} --config {{ odoo_config_file }}

But in default/main.yml, odoo_logfile var is always empty for systemd:

odoo_logfile: "{{ ansible_service_mgr != 'systemd' and ('/'.join([odoo_logdir, odoo_service]) + '.log') or ''}}"

Registering Odoo as a service in systemd: daemon-reload should be invoked

At the moment, "Generate systemd Odoo service (standard)" in tasks/service.yml will notify: Restart Odoo so that the handler that restarts the odoo service is called.
This is not sufficient IMHO.
If a change to systemd services occurs, we get a Warning: odoo.service changed on disk. Run 'systemctl daemon-reload' to reload units. With ansible, we can achieve a daemon-reload with a new handler

- name: Restart systemd
  systemd: daemon_reload=yes

that we place in handlers/main.yml. A change caused by service.yml should then notify both Restart Odoo and Restart systemd.

Please verify / dicuss, I am not the expert here.

git should be installed when used

It would be nice to automatically install git before executing the git actions.
Trying to bootstrap a new dev host for me results in an error because I forgot to manually install git, but the point of the role was to make everything automatic.

wkhtmltox 0.12.4 Debian package not available anymore

https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-stretch-amd64.deb is now a 404.

Changing version var to 0.12.5 didn't fixed the issue since the new URL don't match the pattern (adding a "-1" and removing "-linux_"):

For instance with Stretch / amd64 :

https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb

postgresql add user error

Hi I am new to ansible. I am running this role and encountering an error i.e:

TASK: [odoo | Remote PostgreSQL - Add the Odoo user] **************************
skipping: [158.69.201.193]

TASK: [odoo | Local PostgreSQL - Add the Odoo user] ***************************
failed: [158.69.201.193] => {"failed": true, "parsed": false}
sudo: unknown user: postgres
sudo: unable to initialize policy plugin
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
debug1: mux_client_request_session: master session id: 2
Shared connection to 158.69.201.193 closed.

FATAL: all hosts have already failed -- aborting

and my play book is :


  • hosts: testing
    sudo: yes
    roles:
    • odoo
      vars:
    • odoo_version: 8.0
    • odoo_config_admin_passwd: root
    • odoo_config_db_user: odoo
    • odoo_config_db_passwd: odoo

On (almost) vanilla Ubuntu 16.04, I get error: "Unable to find any of pip3 to use. pip needs to be installed."

Full error message:
TASK [ansible-odoo : Install Odoo dependencies (PyPi)] **************************************************
failed: [xyz.abc.254.6] (item=psycogreen) => {"changed": false, "item": "psycogreen", "msg": "Unable to find any of pip3 to use. pip needs to be installed."}
to retry, use: --limit @/home/joerg/Informatik/Programmierung/hansible/play_odoo.retry

As vanilla Ubuntus come with Python3 installed, I run ansible with ansible_python_interpreter=/usr/bin/python3.

I am not sure if this is an ansible problem or if this Odoo role should take it into account.

odoo not working with variable workers > 0

When I play this playbook on a debian stretch using this playbook:

`

  • name: Odoo 11
    hosts: odoo11
    roles:
    • role: postgresql
      postgresql_version: 9.6
    • role: ansible-odoo
      odoo_version: 11.0
      odoo_config_unaccent: True
      odoo_config_admin_passwd: SuPerPassWorD
      odoo_config_workers: 4
      odoo_config_proxy_mode: True
      `

I get errors like this at the time of trying to start odo
image

If you create a database in odoo with workers=0 it works. But then when you restart the server with workers>0 and access as https://10.0.3.47/web?debug=assets you will again get the same error.

Possible related errors:
odoo/docker#151
odoo/odoo#20158

Files could be downloaded to somewhere else but /root

I noticed that when we download deb files (ie. wkhtmltopdf) we put them in /root and it can't be overridden.
I think we should put them in /opt/<software-name> instead, which would be more suited according to the FHS.

Odoo style compilation failed - lessc failure, no css, broken visuals

Style Compilation failed and something else about web static.
(I wish I could give you the error but it only appeared once and then on reload it went away.)
I always get this error, along with a broken CSS page, sometimes a 'dependences missing: widget.root' browser console error, but lately I get no errors at all in the log, or in browser console, but still it looks broken. I always restart the odoo server.

I've tried updating:

  • the git repo,
  • lessc,
  • less-plugin-clean-css
  • npm
  • ansible roles
  • odoo version 10.0 to odoo 11.0

I've tried blowing away and:

  • re-cloning git repo
  • reinstalling the server
  • recreating my database
  • deleting my filestore
  • browser cache
  • all npm modules
  • npm and nodejs itself
  • odoo config file

I've tried both standard install and buildout install. I've tried an older version of Odoo 10.0, and a custom forked repo on an older version of Odoo 11.0, and a bleeding edge official version. I've tried an ansible version and a non-ansible version

I have no idea what else to try. Ubuntu 16, Odoo 11.0

Keep in mind i've tried various versions, so perhaps there's something old that's leftover
screenshot from 2018-04-11 20-23-12

'odoo_databases' parameter: seems useless, remove it?

An empty database created with the odoo_parameter will make Odoo (by default) initialize it with the 'en_US' language on the first launch, this can be undesired/unintended.
Also, this role aims to just deploy Odoo, not to create a database.

This parameter was added at first to configure the unaccent PostgreSQL extension, but this one could be installed on the default template0 database, from which further Odoo databases will be created.

@clonedagain : are you using this option?

The tag odoo is unnecessary

If I'm not mistaken, the tag "odoo" is set on every task of the main file.
Wouldn't we run the playbook without tags instead if we want to run the whole file?

wkhtmltox download failing on Ubuntu 16.04 Xenial

TASK [sebalix.odoo : Download wkhtmltox] ***************************************
failed: [192.168.33.10] (item=http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-xenial-amd64.deb) => {"dest": "/root/wkhtmltox-0.12.1_linux-xenial-amd64.deb", "failed": true, "item": "http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-xenial-amd64.deb", "msg": "Request failed: ", "state": "absent", "url": "http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-xenial-amd64.deb"}
failed: [192.168.33.10] (item=http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb) => {"dest": "/root/wkhtmltox-0.12.1_linux-xenial-amd64.deb", "failed": true, "item": "http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb", "msg": "Request failed: ", "state": "absent", "url": "http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb"}
failed: [192.168.33.10] (item=http://nightly.odoo.com/extra/wkhtmltox-0.12.1_linux-xenial-amd64.deb) => {"dest": "/root/wkhtmltox-0.12.1_linux-xenial-amd64.deb", "failed": true, "item": "http://nightly.odoo.com/extra/wkhtmltox-0.12.1_linux-xenial-amd64.deb", "msg": "Request failed", "response": "HTTP Error 404: Not Found", "state": "absent", "status_code": 404, "url": "http://nightly.odoo.com/extra/wkhtmltox-0.12.1_linux-xenial-amd64.deb"}

OS: Ubuntu 16.04.2 LTS
Python: 2.7.12

Clone odoo repository with depth=1 ?

Hi there !

This repo is fantastic, thanks for sharing your work (and your knowledge of ansible, especially).
I was wondering, as cloning the Odoo repo is one of the most intensive task of the playbook, why don't you set depth=1 in the install task ?

OCA repositories

It would be nice to be able to set a list of OCA projects we want to deploy, and have them automatically cloned from github.

private repo on buildouts

AFAIK it's not possible to put the ssh key of the repo in the buildout config file, like: [email protected]:aheficent/my_pricate_repo.git

However, if I put the hppts git address in the buildout config file, like, https://github.com/aheficent/my_private_repo.git I get an error:
fatal: could not read Username for 'https://github.com': No such device or address

Is it possible to setup ansible-odoo with buildouts with private repos?

Thanks in advance!

ERROR! Unexpected Exception: 'bool' object has no attribute 'split'

I get the following error more often than not, but not all the time.

TASK [sebalix.odoo-local : Local PostgreSQL - Active the 'unaccent' extension on databases] ***
task path: /home/daniel/dev/odoo/releasing-odoo/roles/sebalix.odoo-local/tasks/postgresql_local.yml:16
<178.62.35.198> ESTABLISH SSH CONNECTION FOR USER: root
<178.62.35.198> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 178.62.35.198 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1472145122.31-245493941872480 `" && echo ansible-tmp-1472145122.31-245493941872480="` echo /tmp/ansible-tmp-1472145122.31-245493941872480 `" ) && sleep 0'"'"''
<178.62.35.198> PUT /tmp/tmpgWDE8m TO /tmp/ansible-tmp-1472145122.31-245493941872480/postgresql_ext
<178.62.35.198> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r '[178.62.35.198]'
<178.62.35.198> ESTABLISH SSH CONNECTION FOR USER: root
<178.62.35.198> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 178.62.35.198 '/bin/sh -c '"'"'chown -R postgres /tmp/ansible-tmp-1472145122.31-245493941872480/ && sleep 0'"'"''
<178.62.35.198> ESTABLISH SSH CONNECTION FOR USER: root
<178.62.35.198> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r -tt 178.62.35.198 '/bin/sh -c '"'"'sudo -H -S -n -u postgres /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-tvayagltobrcmldhlseqqnbxktqmrhzp; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /tmp/ansible-tmp-1472145122.31-245493941872480/postgresql_ext'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<178.62.35.198> ESTABLISH SSH CONNECTION FOR USER: root
<178.62.35.198> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 178.62.35.198 '/bin/sh -c '"'"'rm -f -r /tmp/ansible-tmp-1472145122.31-245493941872480/ > /dev/null 2>&1 && sleep 0'"'"''
ok: [eagle] => {"changed": false, "db": "template1", "invocation": {"module_args": {"db": "template1", "ext": "unaccent", "login_host": "", "login_password": "", "login_user": "postgres", "name": "unaccent", "port": "5432", "state": "present"}, "module_name": "postgresql_ext"}}
ERROR! Unexpected Exception: 'bool' object has no attribute 'split'
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 86, in <module>
    sys.exit(cli.run())
  File "/usr/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 154, in run
    results = pbex.run()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 146, in run
    result = self._tqm.run(play=play)
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 264, in run
    play_return = strategy.run(iterator, play_context)
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/strategy/linear.py", line 226, in run
    task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
  File "/usr/lib/python2.7/dist-packages/ansible/vars/__init__.py", line 371, in get_vars
    all_vars['ansible_delegated_vars'] = self._get_delegated_vars(loader, play, task, all_vars)
  File "/usr/lib/python2.7/dist-packages/ansible/vars/__init__.py", line 516, in _get_delegated_vars
    include_hostvars=False,
  File "/usr/lib/python2.7/dist-packages/ansible/vars/__init__.py", line 264, in get_vars
    all_vars = combine_vars(all_vars, host.get_vars())
  File "/usr/lib/python2.7/dist-packages/ansible/inventory/host.py", line 132, in get_vars
    results['inventory_hostname_short'] = self.name.split('.')[0]
AttributeError: 'bool' object has no attribute 'split'

I'm not sure if it might be something to do with lines (34 or 41 of tasks/main.yml](https://github.com/osiell/ansible-odoo/blob/master/tasks/main.yml#L34)??
Looks similar to

Is buildout still a viable option?

I looked at a few attempts at adding support for Odoo 12 and Ubuntu 18.04 bionic to the role, and found that the buildout part was the only non-trivial fix. It seems to depend on a development version of anybox.recipy.odoo, for which the last published release (1.9.2) is from 2016.

I'm perfectly happy using either of the two alternative install methods, so I'm not really well positioned to do a deep dive into buildout. Are people actively using buildout? Has buildout development moved to a place that's off my radar? If buildout has stalled, I'd like to propose adding Odoo 12 with a footnote that buildout is not supported for now.

Travis is happy for the pip and standard builds, so I was wondering what the best way forward would be.

Static content not found with default addons path

The default for odoo_config_addons_path creates two paths. Installation with odoo 10.0 does not seem to have the first path /home/*/odoo/server/openerp/addons. Something about a non-existent directory causes odoo to not properly serve the static content like css and js.

odoo_config_addons_path:
    - "/home/{{ odoo_user }}/odoo/server/openerp/addons"
    - "/home/{{ odoo_user }}/odoo/server/addons"

Set SSH key failed and parsing error when evaluating postgres_remote

It seems that the when statements are sometimes wrong :

tasks/main.yml :

  • include: postgresql_local.yml
    when: (odoo_config_db_host == 'False') or (odoo_config_db_host == 'localhost') or (odoo_config_db_host == '127.0.0.1')
    tags:
    • odoo
    • odoo_postgresql
    • odoo_postgresql_local
  • include: postgresql_remote.yml
    when: (odoo_config_db_host != 'False') and (odoo_config_db_host != 'localhost') and (odoo_config_db_host != '127.0.0.1')
    tags:
    • odoo
    • odoo_postgresql
    • odoo_postgresql_remote

The when statement is not a python statement. With this version I fixed a error on a split of a variable name.

I also had to comment the install_extra task because it was evaluated even with odoo_user_sshkeys set to False, and this was causing an error because fileglob receive a bool instead of a string.


Actually I'm wrong, it was not a when statement problem but a bug with delegate_to that is evaluated before the when, causing crash when db_host set to False. Fixed by setting db_host to 127.0.0.1 instead of False

Install via pip - how to proceed when a module already exists?

Currently if you have an existing installation that contains an OCA module installed using pip, that perhaps was installed referring to a PR, and then this PR is merged into OCA, you may get this situation when you do pip install -r requirements.txt:

What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup

The problem is that ansible runs all the steps automatically, and this one is treated as an error.

Perhaps in the ansible role we should always wipe all the OCA modules every time, or force update of them all?

One thing I do not like with the ansible approach is that in general, as the ansible role evolves, the old packages, python modules, etc.. are not going to be removed. This is something that Docker does better, as it creates from scratch every time, ensuring that there's no artifact sitting in the server that is not included in the configuration files.

cc @sbidoul perhaps you know how to force the pip install to always wipe the old pip module?

Installing the database Odoo via ansible

Can I use the ansible to give such commands:

$ ./odoo-bin shell

$ from openerp.service import db
db.exp_create_database('dbname',False,'ru_RU','admin','admin')

or
$ ./odoo-bin -d dbname -i crm,sale --without-demo=all

If yes, then please help how it can be done.

Thanks!

Deploy odoo ansible

Hello everybody,

I'm new with ansible, I have just cloned the ansible-odoo repo.
Now what are the steps to deploy odoo 11 on my server?
Kind regards

AttributeError: 'bool' object has no attribute 'rfind' when sshkeys set to False

I'm on Ansible 2.1 (Ubuntu 16.04) and I find the following error when I try to use this role.
I've tried setting odoo_user_sshkeys: to False, 0, "False", but I just get variations on the same error.

TASK [sebalix.odoo : Set SSH public keys for the Odoo user] ********************
task path: /etc/ansible/roles/sebalix.odoo/tasks/install_extra.yml:3
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 93, in run
    items = self._get_loop_items()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 195, in _get_loop_items
    items = self._shared_loader_obj.lookup_loader.get(self._task.loop, loader=self._loader, templar=templar).run(terms=loop_terms, variables=self._job_vars, wantlist=True)
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/lookup/fileglob.py", line 33, in run
    term_file = os.path.basename(term)
  File "/usr/lib/python2.7/posixpath.py", line 114, in basename
    i = p.rfind('/') + 1
AttributeError: 'bool' object has no attribute 'rfind'

fatal: [eagle]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}

Don't validate odoo_config_db_host if `--skip-tags='odoo_postgresql'`

I am trying to deploy odoo in AWS with an RDS instance.
As such, my setup is the following (if you want I can push the packer + terraform files when all will be working):

  1. Make an AMI build with packer, with the following setup:
    • odoo_config_db_host is set to a record which doesn't exists yet (eg: odoo-db.ndd.tld)
    • odoo_init set to False as the AMI is build before any resources are not ready yet
    • use ansible-playbook (...) --skip-tags='odoo_postgresql' because the RDS instance is not ready at this time
  2. Build the infra:
    1. create the postgresql RDS instance
    2. create the Route 53 record pointing to this RDS instance
    3. pop the EC2 instance from the AMI build
  3. Finish the deployment:
    1. use ansible-playbook --tags='odoo_postgresql,odoo_service' with extra_vars: odoo_init: True

My issues:

  • Because of the hostvars check in odoo-server-v80.conf, Ansible fail if my record is not in the inventory. RDS not being managed by ansible, I don't want that so I simply removed the check, but I don't know how this should be done to support all the use cases.
  • Also, I don't want ansible to create role and database as RDS do it when we create the resource. This should be behind an opt-out something (tag ? variable ? other ?). I simply removed the tasks, which will not be ideal for you.

But thank you for thinking of the CREATE EXTENSION IF NOT EXISTS 👍 , this is indeed needed when creating immutable builds (aKa: an AMI which doesn't have side-effects when resources already exists so that we can redeploy at wish at every change).

Missing tool: psycogreen requires python-setuptools (failed on Stretch)

Hi,

I'm unable to install psycogreen on Stretch:

TASK [sebalix.odoo : Install Odoo dependencies (PyPi)] 
*****************************************************************************************
failed: [145.239.194.108] (item=psycogreen) => {"changed": false, "cmd": "/usr/bin/pip2 install psycogreen", "item": "psycogreen", "msg": "stdout: Collecting psycogreen\n  Downloading https://files.pythonhosted.org/packages/66/29/9250c6a11822f56a1c2f703e4031d173c5b3725095d3422c11cafcc5427f/psycogreen-1.0.tar.gz\n    Complete output from command python setup.py egg_info:\n    Traceback (most recent call last):\n      File \"<string>\", line 1, in <module>\n    ImportError: No module named setuptools\n    \n    ----------------------------------------\n\n:stderr: Command \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-build-kxCSb9/psycogreen/\n"}

Adding python-setuptools to odoo_required_tools fixes the issue.
I could make a PR if ok.

use updated URL for wkhtmltopdf downloads

Hello,

wkhtmltopdf has moved the downloads provider from SourceForge to gna.org. As mentioned in the linked message, all earlier downloads have been removed from SourceForge and you are strongly advised to migrate to the new URLs. The following files in your repository will need to be updated:

  • vars/main.yml

It is recommended to either subscribe to the mailing list or Twitter feed to receive updates on new releases and further changes.

Thanks,
wkhtmltopdf maintainer

init file doesn't look odoo_config_logfile var

In templates/odoo-9.0.init and templates/odoo-8.0.init, I suggest to replace this line :
LOGFILE={{ odoo_logdir }}/{{ odoo_service }}.log
by this line :
LOGFILE={{ odoo_config_logfile }}
Or even remove the line
Because otherwise the logfile parameter for the init daemon overwrite the logfile value in odoo config file

oca.odoo was not found on https://galaxy.ansible.com

Hello,

I'm unable to install oca.odoo role via Ansible Galaxy :

$ ansible-galaxy install oca.odoo
- downloading role 'odoo', owned by oca
 [WARNING]: - oca.odoo was NOT installed successfully: - sorry, oca.odoo was not found on https://galaxy.ansible.com.

No role is found from author "oca".

Any idea?

Thx.

Phantom installation failed (Stretch)

Sorry another issue with the role:

This time it's about NodeJS dependency phantomjs-prebuit:

TASK [sebalix.odoo : Install Odoo dependencies (npm)] 
******************************************************************************************
changed: [145.239.194.108] => (item={'name': 'less', 'version': '2.7.2'})
changed: [145.239.194.108] => (item={'name': 'less-plugin-clean-css', 'version': '1.5.1'})
failed: [145.239.194.108] (item={'name': 'phantomjs-prebuilt', 'version': '2.1.15'}) => {"changed": false, "cmd": "/usr/bin/npm install --global ''", "item": {"name": "phantomjs-prebuilt", "version": "2.1.15"}, "msg": "Error extracting archive\nPhantom installation failed { Error:********@2.1.15 install script 'node install.js'.\nnpm ERR! Make sure you have the latest version of node.js and npm installed.\nnpm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,\nnpm ERR! not with npm itself.\nnpm ERR! Tell the author that this fails on your system:\nnpm ERR!     node install.js\nnpm ERR! You can get information on how to open an issue for this project with:\nnpm ERR!     npm bugs phantomjs-prebuilt\nnpm ERR! Or if that isn't available, you can get their info via:\nnpm ERR!     npm owner ls phantomjs-prebuilt\nnpm ERR! There is likely additional logging output above.\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR!     /home/debian/npm-debug.log", "rc": 1, "stderr": "Error extracting archive\nPhantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2\ntar (child): bzip2: Cannot exec: No such file or directory\ntar (child): Error is not recoverable: exiting now\ntar: Child returned status 2\ntar: Error is not recoverable: exiting now\n\n    at ChildProcess.exithandler (child_process.js:199:12)\n    at emitTwo (events.js:106:13)\n    at ChildProcess.emit (events.js:191:7)\n    at maybeClose (internal/child_process.js:920:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)\n  killed: false,\n  code: 2,\n  signal: null,\n  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' } Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2\ntar (child): bzip2: Cannot exec: No such file or directory\ntar (child): Error is not recoverable: exiting now\ntar: Child returned status 2\ntar: Error is not recoverable: exiting now\n\n    at ChildProcess.exithandler (child_process.js:199:12)\n    at emitTwo (events.js:106:13)\n    at ChildProcess.emit (events.js:191:7)\n    at maybeClose (internal/child_process.js:920:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)\nnpm ERR! Linux 4.9.0-6-amd64\nnpm ERR! argv \"/usr/bin/node\" \"/usr/bin/npm\" \"install\" \"--global\" \"[email protected]\"\nnpm ERR! node v6.14.3\nnpm ERR! npm  v3.10.10\nnpm ERR! code ELIFECYCLE\n\nnpm ERR! [email protected] install: `node install.js`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the [email protected] install script 'node install.js'.\nnpm ERR! Make sure you have the latest version of node.js and npm installed.\nnpm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,\nnpm ERR! not with npm itself.\nnpm ERR! Tell the author that this fails on your system:\nnpm ERR!     node install.js\nnpm ERR! You can get information on how to open an issue for this project with:\nnpm ERR!     npm bugs phantomjs-prebuilt\nnpm ERR! Or if that isn't available, you can get their info via:\nnpm ERR!     npm owner ls phantomjs-prebuilt\nnpm ERR! There is likely additional logging output above.\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR!     /home/debian/npm-debug.log\n", "stderr_lines": ["Error extracting archive", "Phantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2", "tar (child): bzip2: Cannot exec: No such file or directory", "tar (child): Error is not recoverable: exiting now", "tar: Child returned status 2", "tar: Error is not recoverable: exiting now", "", "    at ChildProcess.exithandler (child_process.js:199:12)", "    at emitTwo (events.js:106:13)", "    at ChildProcess.emit (events.js:191:7)", "    at maybeClose (internal/child_process.js:920:16)", "    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)", "  killed: false,", "  code: 2,", "  signal: null,", "  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' } Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2", "tar (child): bzip2: Cannot exec: No such file or directory", "tar (child): Error is not recoverable: exiting now", "tar: Child returned status 2", "tar: Error is not recoverable: exiting now", "", "    at ChildProcess.exithandler (child_process.js:199:12)", "    at emitTwo (events.js:106:13)", "    at ChildProcess.emit (events.js:191:7)", "    at maybeClose (internal/child_process.js:920:16)", "    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)", "npm ERR! Linux 4.9.0-6-amd64", "npm ERR! argv \"/usr/bin/node\" \"/usr/bin/npm\" \"install\" \"--global\" \"[email protected]\"", "npm ERR! node v6.14.3", "npm ERR! npm  v3.10.10", "npm ERR! code ELIFECYCLE", "", "npm ERR! [email protected] install: `node install.js`", "npm ERR! Exit status 1", "npm ERR! ", "npm ERR! Failed at the [email protected] install script 'node install.js'.", "npm ERR! Make sure you have the latest version of node.js and npm installed.", "npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,", "npm ERR! not with npm itself.", "npm ERR! Tell the author that this fails on your system:", "npm ERR!     node install.js", "npm ERR! You can get information on how to open an issue for this project with:", "npm ERR!     npm bugs phantomjs-prebuilt", "npm ERR! Or if that isn't available, you can get their info via:", "npm ERR!     npm owner ls phantomjs-prebuilt", "npm ERR! There is likely additional logging output above.", "", "npm ERR! Please include the following file with any support request:", "npm ERR!     /home/debian/npm-debug.log"], "stdout": "/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs-prebuilt/bin/phantomjs\n\n> [email protected] install /usr/lib/node_modules/phantomjs-prebuilt\n> node install.js\n\nConsidering PhantomJS found at /usr/bin/phantomjs\nLooks like an `npm install -g`\nCould not link global install, skipping...\nDownloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2\nSaving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2\nReceiving...\n\nReceived 22866K total.\nExtracting tar contents (via spawned process)\n", "stdout_lines": ["/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs-prebuilt/bin/phantomjs", "", "> [email protected] install /usr/lib/node_modules/phantomjs-prebuilt", "> node install.js", "", "Considering PhantomJS found at /usr/bin/phantomjs", "Looks like an `npm install -g`", "Could not link global install, skipping...", "Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2", "Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2", "Receiving...", "", "Received 22866K total.", "Extracting tar contents (via spawned process)"]}

UnicodeEncodeError on install.

When I use this role for installation, the server starts up and gives me the database creation screen no problem. However, I get the following error when trying to create a database. Does anyone have any insight?

2015-08-20 16:23:50,204 14193 INFO None openerp.service.db: Create database `first`.
2015-08-20 16:23:51,062 14193 ERROR None openerp.sql_db: bad query: INSERT INTO ir_module_module                 (author, website, name, shortdesc, description,                     category_id, auto_install, state, web, license, application, icon, sequence, summary)                 VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING id
Traceback (most recent call last):
  File "/home/odoo/odoo/server/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128)
2015-08-20 16:23:51,064 14193 ERROR None openerp.service.db: CREATE DATABASE failed:

"Unexpected failure during module execution.", "stdout": ""

One of the tasks, I get this error:

root@50255:~/ansible# ansible-playbook /etc/ansible/playbooks/base-odoo.yml

PLAY [Install odoo] ************************************************************

TASK [setup] *******************************************************************
ok: [*******************]

TASK [sebalix.odoo : Setting variables depending on the Odoo version] **********
ok: [*******************] => (item=/etc/ansible/roles/sebalix.odoo/templates/../vars/Odoo-8.yml)

TASK [sebalix.odoo : Setting variables depending on the distribution release] **
ok: [*******************] => (item=/etc/ansible/roles/sebalix.odoo/templates/../vars/Ubuntu.yml)

TASK [sebalix.odoo : Install required tools] ***********************************
changed: [*******************] => (item=[u'sudo', u'git', u'mercurial', u'python-pip'])

TASK [sebalix.odoo : Install Odoo dependencies] ********************************
changed: [*******************] => (item=[u'python-dev', u'python-psycopg2', u'python-simplejson', u'python-lxml', u'python-tz', u'python-imaging', u'python-yaml', u'python-reportlab', u'python-mako', u'python-pychart', u'python-werkzeug', u'python-dateutil', u'python-unittest2', u'python-mock', u'python-openid', u'python-docutils', u'python-feedparser', u'python-gdata', u'python-jinja2', u'python-psutil', u'python-pydot', u'python-webdav', u'python-vatnumber', u'python-vobject', u'python-xlwt', u'python-ldap', u'python-openssl', u'python-egenix-mxdatetime', u'python-zsi', u'python-requests', u'python-pypdf', u'python-decorator', u'python-passlib', u'python-babel', u'python-gevent'])

TASK [sebalix.odoo : Install Odoo dependencies (PyPi)] *************************
changed: [*******************] => (item=psycogreen)

TASK [sebalix.odoo : Check that '/usr/bin/nodejs' exists] **********************
skipping: [*******************]

TASK [sebalix.odoo : Check that '/usr/local/bin/node' exists] ******************
skipping: [*******************]

TASK [sebalix.odoo : Add symlink '/usr/local/bin/node'] ************************
skipping: [*******************]

TASK [sebalix.odoo : Install Odoo dependencies (npm)] **************************
skipping: [*******************] => (item=odoo_npm_packages)

TASK [sebalix.odoo : Add Odoo system user] *************************************
changed: [*******************]

TASK [sebalix.odoo : Create log directory] *************************************
changed: [*******************]

TASK [sebalix.odoo : Project repository already cloned?] ***********************
ok: [*******************]

TASK [sebalix.odoo : Clone project repository (Mercurial)] *********************
skipping: [*******************]

TASK [sebalix.odoo : Clone project repository (Git)] ***************************
changed: [*******************]

TASK [sebalix.odoo : Set SSH public keys for the Odoo user] ********************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'bool' object has no attribute 'rfind'
fatal: [*******************]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}

RUNNING HANDLER [sebalix.odoo : Restart Odoo] **********************************
to retry, use: --limit @/etc/ansible/playbooks/base-odoo.retry

PLAY RECAP *********************************************************************
******************* : ok=10 changed=6 unreachable=0 failed=1

AnsibleError: Unexpected templating type error occurred: exceptions must be old-style classes or derived from BaseException, not type

I get this error with the following playbook on Debian Jessie:

- hosts: p711-node
  roles:
    - role: odoo
      odoo_version: 8.0
      odoo_config_admin_passwd: AdminPassword
      odoo_config_db_host: 192.168.192.13
      odoo_config_db_user: odoo
      odoo_config_db_passwd: SomePassword

The error happens in templates/odoo-8.0.conf on the following line:

db_host = {{ odoo_config_db_host not in [False, 'localhost', '127.0.0.1'] and hostvars.get(odoo_config_db_host, {}).get('ansible_ssh_host') or odoo_config_db_host }}

It's the hostvars expression. What was intended here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.