diff --git a/defaults/main.yml b/defaults/main.yml index c270c5c..f8663de 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,10 +12,10 @@ odoo_init: True odoo_init_env: {} #VAR1: value1 #VAR2: value2 -odoo_logdir: "/var/log/{{ odoo_user }}" +odoo_logdir: "/var/log" odoo_logfile: "{{ ansible_service_mgr != 'systemd' and ('/'.join([odoo_logdir, odoo_service]) + '.log') or ''}}" -odoo_workdir: "/home/{{ odoo_user }}/odoo" -odoo_rootdir: "{{ odoo_install_type == 'buildout' and '/home/'+odoo_user+'/odoo/parts/odoo' or '/home/'+odoo_user+'/odoo/server' }}" +odoo_workdir: "/home/{{ odoo_user }}/{{ odoo_service }}" +odoo_rootdir: "{{ '/home/'+odoo_user+'/'+odoo_service }}" # Project repository to deploy odoo_repo_type: git # git or hg @@ -39,7 +39,8 @@ odoo_postgresql_extensions: - unaccent # Standard installation/configuration options (odoo_install_type == 'standard') -odoo_config_file: "/home/{{ odoo_user }}/{{ odoo_service }}.conf" +odoo_config_file_dir: "/home/{{ odoo_user }}" +odoo_config_file: "{{ odoo_config_file_dir }}/{{ odoo_service }}.conf" odoo_force_config: True odoo_config_addons_path: - "/home/{{ odoo_user }}/odoo/server/{{ (odoo_version | int) < 10 and 'openerp' or 'odoo' }}/addons" @@ -106,13 +107,13 @@ odoo_config_custom: {} #your_option2: value2 # Pip installation options (odoo_install_type == 'pip') -odoo_pip_venv_path: "{{ odoo_workdir }}/sandbox" +odoo_pip_venv_path: "{{ odoo_workdir }}/{{ odoo_service }}/sandbox" odoo_pip_requirements_url: "file:///home/{{ odoo_user }}/requirements.txt" odoo_pip_odoo_bin_path: "{{ odoo_pip_venv_path }}/bin/{{ (odoo_version | int) < 10 and 'odoo.py' or 'odoo' }}" # Buildout installation options (odoo_install_type == 'buildout') odoo_buildout_version: 2.10.0 -odoo_buildout_venv_path: "{{ odoo_workdir }}/sandbox" +odoo_buildout_venv_path: "{{ odoo_workdir }}/{{ odoo_service }}/sandbox" odoo_buildout_bootstrap_path: "{{ odoo_workdir }}/bootstrap.py" odoo_buildout_bootstrap_cmd: "{{ odoo_buildout_venv_path }}/bin/python {{ odoo_buildout_bootstrap_path }} -c {{ odoo_buildout_config_path }} --buildout-version {{ odoo_buildout_version }}" odoo_buildout_bin_path: "{{ odoo_workdir }}/bin/buildout" diff --git a/tasks/install.yml b/tasks/install.yml index fcca158..d6567c6 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -25,7 +25,7 @@ - odoo_install_ssh - name: Create log directory - file: path={{ odoo_logdir }} state=directory + file: path={{ odoo_logdir }}/{{ odoo_service }} state=directory owner={{ odoo_user }} group={{ odoo_user }} force=no tags: - odoo_log @@ -62,8 +62,28 @@ tags: - odoo_project +- name: Create working dir directory + file: path={{ odoo_workdir }}/{{ odoo_service }} state=directory + owner={{ odoo_user }} group={{ odoo_user }} force=yes + +- name: Create odoo server directory + file: path={{ odoo_rootdir }}/{{ odoo_service }}/server state=directory + owner={{ odoo_user }} group={{ odoo_user }} force=yes + when: odoo_install_type != 'pip' + tags: + - odoo_install_type_standard + - odoo_install_type_buildout + +- name: Create odoo config file directory + file: path={{ odoo_config_file_dir }}/{{ odoo_service }} state=directory + owner={{ odoo_user }} group={{ odoo_user }} force=yes + when: odoo_install_type != 'buildout' + tags: + - odoo_install_type_pip + - odoo_install_type_standard + - name: Create odoo data dir directory - file: path={{ odoo_config_data_dir }} state=directory + file: path={{ odoo_config_data_dir }}/{{ odoo_service }} state=directory owner={{ odoo_user }} group={{ odoo_user }} force=yes when: odoo_install_type != 'buildout' tags: diff --git a/templates/odoo-10.0.init b/templates/odoo-10.0.init index 1b9a7a7..e39c6a1 100644 --- a/templates/odoo-10.0.init +++ b/templates/odoo-10.0.init @@ -16,7 +16,7 @@ PATH=/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin WORKDIR={{ odoo_workdir }} -DAEMON={{ odoo_rootdir }}/odoo-bin +DAEMON={{ odoo_rootdir }}/{{ odoo_service }}/server/odoo-bin NAME={{ odoo_service }} DESC={{ odoo_service }} CONFIG={{ odoo_config_file }} diff --git a/templates/odoo-8.0.init b/templates/odoo-8.0.init index 322e1a8..32f738a 100644 --- a/templates/odoo-8.0.init +++ b/templates/odoo-8.0.init @@ -16,7 +16,7 @@ PATH=/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin WORKDIR={{ odoo_workdir }} -DAEMON={{ odoo_rootdir }}/odoo.py +DAEMON={{ odoo_rootdir }}/{{ odoo_service }}/server/odoo.py NAME={{ odoo_service }} DESC={{ odoo_service }} CONFIG={{ odoo_config_file }} diff --git a/templates/odoo-9.0.init b/templates/odoo-9.0.init index 322e1a8..32f738a 100644 --- a/templates/odoo-9.0.init +++ b/templates/odoo-9.0.init @@ -16,7 +16,7 @@ PATH=/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin WORKDIR={{ odoo_workdir }} -DAEMON={{ odoo_rootdir }}/odoo.py +DAEMON={{ odoo_rootdir }}/{{ odoo_service }}/server/odoo.py NAME={{ odoo_service }} DESC={{ odoo_service }} CONFIG={{ odoo_config_file }} diff --git a/templates/odoo-standard.service b/templates/odoo-standard.service index e4ad3e7..3f4f819 100644 --- a/templates/odoo-standard.service +++ b/templates/odoo-standard.service @@ -7,10 +7,10 @@ Type=simple User={{ odoo_user }} WorkingDirectory={{ odoo_workdir }} {% if odoo_version | version_compare('10.0', '>=') %} -ExecStart={{ odoo_rootdir }}/odoo-bin{{ odoo_logfile and ' --logfile %s' % odoo_logfile }} --config {{ odoo_config_file }} +ExecStart={{ odoo_rootdir }}/{{ odoo_service }}/server/odoo-bin{{ odoo_logfile and ' --logfile %s' % odoo_logfile }} --config {{ odoo_config_file }} KillMode=mixed {% else %} -ExecStart={{ odoo_rootdir }}/odoo.py{{ odoo_logfile and ' --logfile %s' % odoo_logfile }} --config {{ odoo_config_file }} +ExecStart={{ odoo_rootdir }}/{{ odoo_service }}/server/odoo.py{{ odoo_logfile and ' --logfile %s' % odoo_logfile }} --config {{ odoo_config_file }} {% endif %} {% for name, value in odoo_init_env.iteritems() %} Environment={{ name }}={{ value }} diff --git a/vars/Ubuntu-16_Odoo-11.yml b/vars/Ubuntu-16_Odoo-11.yml index 890ceec..5a73a61 100644 --- a/vars/Ubuntu-16_Odoo-11.yml +++ b/vars/Ubuntu-16_Odoo-11.yml @@ -96,7 +96,7 @@ odoo_buildout_build_dependencies: - libwebp-dev odoo_buildout_venv_cmd: "virtualenv --no-setuptools --python=python3 {{ odoo_buildout_venv_path }}" -odoo_pip_venv_cmd: "virtualenv --python=python3 {{ odoo_pip_venv_path }}" +ยบ: "virtualenv --python=python3 {{ odoo_pip_venv_path }}" odoo_wkhtmltox_version: 0.12.4