mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-04-22 21:23:23 +02:00
Update to 2023-07-20 14:00
This commit is contained in:
parent
46009264eb
commit
5fa912498c
@ -1,13 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Version of Odoo to deploy
|
# Version of Odoo to deploy (name of the branch of the git repo
|
||||||
odoo_version: 16.0
|
odoo_version: 16.0
|
||||||
# Odoo Build
|
# URL of the repository
|
||||||
odoo_build: 20230323
|
odoo_git_url: https://github.com/odoo/odoo.git
|
||||||
# URL of the archive
|
|
||||||
odoo_archive_url: https://nightly.odoo.com/{{ odoo_version }}/nightly/tgz/odoo_{{ odoo_version }}.{{ odoo_build }}.tar.gz
|
# Where will odoo be installed
|
||||||
# Checksum of the archive
|
|
||||||
odoo_archive_sha256: 9e685e4a49fd6dd15b4e71f20ae9fc31a7b1b4b70f3d79ed52dddd021804ef77
|
|
||||||
odoo_root_dir: /opt/odoo
|
odoo_root_dir: /opt/odoo
|
||||||
|
|
||||||
# User under which odoo will run (will be created if needed
|
# User under which odoo will run (will be created if needed
|
||||||
@ -15,20 +13,32 @@ odoo_user: odoo
|
|||||||
|
|
||||||
# Database settings
|
# Database settings
|
||||||
odoo_db_server: "{{ pg_server | default('localhost') }}"
|
odoo_db_server: "{{ pg_server | default('localhost') }}"
|
||||||
|
odoo_db_port: 5432
|
||||||
odoo_db_name: odoo
|
odoo_db_name: odoo
|
||||||
odoo_db_user: odoo
|
odoo_db_user: odoo
|
||||||
# If not defined, a random password will be generated and stored under {{ odoo_root_dir }}/meta
|
# If not defined, a random password will be generated and stored under {{ odoo_root_dir }}/meta
|
||||||
# odoo_db_pass: secret
|
# odoo_db_pass: secret
|
||||||
|
|
||||||
# List of IP/CIDR which will be able to reach Odoo ports
|
# List of IP/CIDR which will be able to reach Odoo ports
|
||||||
|
# This should be empty most of the time to access Odoo only from the nginx reverse proxy
|
||||||
odoo_src_ip: []
|
odoo_src_ip: []
|
||||||
|
|
||||||
|
# Public URL of the odoo instance
|
||||||
|
# odoo_public_url: https://erp.domain.tld/
|
||||||
|
|
||||||
odoo_http_port: 8069
|
odoo_http_port: 8069
|
||||||
odoo_longpolling_port: 8072
|
odoo_longpolling_port: 8072
|
||||||
odoo_ports: [ "{{ odoo_http_port }}","{{ odoo_longpolling_port }}" ]
|
odoo_ports: [ "{{ odoo_http_port }}", "{{ odoo_longpolling_port }}" ]
|
||||||
|
|
||||||
odoo_workers: 4
|
odoo_workers: 4
|
||||||
odoo_email: "{{ system_admin_email | default('admin' + ansible_domain ) }}"
|
odoo_email: "{{ system_admin_email | default('admin' + ansible_domain ) }}"
|
||||||
|
|
||||||
# If enabled, db manager will be accessible
|
# If enabled, db manager will be accessible
|
||||||
odoo_db_list: False
|
odoo_db_list: False
|
||||||
|
|
||||||
|
# If you turn enterprise on, you need to set the SSH key of the root account of the target system
|
||||||
|
# on your Github account, allowed to access the https://github.com/odoo/enterprise.git repo
|
||||||
|
# You should also accept the host key for example by running
|
||||||
|
# /bin/git ls-remote git@github.com:odoo/enterprise.git as the root user
|
||||||
|
odoo_enterprise: False
|
||||||
|
odoo_enterprise_git_url: git@github.com:odoo/enterprise.git
|
||||||
|
@ -4,4 +4,6 @@ dependencies:
|
|||||||
- role: mkdir
|
- role: mkdir
|
||||||
- role: wkhtmltopdf
|
- role: wkhtmltopdf
|
||||||
- role: postgresql_server
|
- role: postgresql_server
|
||||||
|
pg_version: 15
|
||||||
when: odoo_db_server in ['localhost', '127.0.0.1']
|
when: odoo_db_server in ['localhost', '127.0.0.1']
|
||||||
|
- role: nginx
|
||||||
|
@ -2,7 +2,5 @@
|
|||||||
|
|
||||||
- name: Remove temp files
|
- name: Remove temp files
|
||||||
file: path={{ item }} state=absent
|
file: path={{ item }} state=absent
|
||||||
with_items:
|
with_items: []
|
||||||
- "{{ odoo_root_dir }}/tmp/odoo_{{ odoo_version }}.{{ odoo_build }}.tar.gz"
|
|
||||||
- "{{ odoo_root_dir }}/tmp/odoo-{{ odoo_version }}.post{{ odoo_build }}"
|
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
@ -18,3 +18,7 @@
|
|||||||
|
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
|
||||||
|
- name: Install nginx configuration
|
||||||
|
template: src=nginx.conf.j2 dest=/etc/nginx/ansible_conf.d/33-odoo.conf
|
||||||
|
notify: reload nginx
|
||||||
|
tags: odoo,web
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- path: "{{ odoo_root_dir }}"
|
- path: "{{ odoo_root_dir }}"
|
||||||
owner: "{{ odoo_user }}"
|
owner: "{{ odoo_user }}"
|
||||||
mode: 700
|
mode: 775
|
||||||
- path: "{{ odoo_root_dir }}/tmp"
|
- path: "{{ odoo_root_dir }}/tmp"
|
||||||
- path: "{{ odoo_root_dir }}/meta"
|
- path: "{{ odoo_root_dir }}/meta"
|
||||||
mode: 700
|
mode: 700
|
||||||
@ -18,5 +18,6 @@
|
|||||||
- path: "{{ odoo_root_dir }}/data"
|
- path: "{{ odoo_root_dir }}/data"
|
||||||
group: "{{ odoo_user }}"
|
group: "{{ odoo_user }}"
|
||||||
mode: 770
|
mode: 770
|
||||||
|
- path: "{{ odoo_root_dir }}/enterprise"
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
- import_tasks: ../includes/webapps_set_install_mode.yml
|
- import_tasks: ../includes/webapps_set_install_mode.yml
|
||||||
vars:
|
vars:
|
||||||
- root_dir: "{{ odoo_root_dir }}"
|
- root_dir: "{{ odoo_root_dir }}"
|
||||||
- version: "{{ odoo_version }}-{{ odoo_build }}"
|
- version: "{{ odoo_version }}"
|
||||||
- set_fact: odoo_install_mode={{ install_mode | default('none') }}
|
- set_fact: odoo_install_mode={{ install_mode | default('none') }}
|
||||||
- set_fact: odoo_current_version={{ current_version | default('') }}
|
- set_fact: odoo_current_version={{ current_version | default('') }}
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
@ -6,29 +6,36 @@
|
|||||||
|
|
||||||
- when: odoo_install_mode != 'none'
|
- when: odoo_install_mode != 'none'
|
||||||
block:
|
block:
|
||||||
- name: Fetch odoo sources
|
- name: Clone or update the repo
|
||||||
get_url:
|
git:
|
||||||
url: "{{ odoo_archive_url }}"
|
repo: "{{ odoo_git_url }}"
|
||||||
dest: "{{ odoo_root_dir }}/tmp"
|
dest: "{{ odoo_root_dir }}/app"
|
||||||
checksum: sha256:{{ odoo_archive_sha256 }}
|
depth: 1
|
||||||
|
version: "{{ odoo_version }}"
|
||||||
|
force: True
|
||||||
|
notify: restart odoo-server
|
||||||
|
|
||||||
- name: Extract odoo archive
|
- name: Add ACL
|
||||||
unarchive:
|
command: |
|
||||||
src: "{{ odoo_root_dir }}/tmp/odoo_{{ odoo_version }}.{{ odoo_build }}.tar.gz"
|
setfacl -R -b -k {{ odoo_root_dir }}
|
||||||
dest: "{{ odoo_root_dir }}/tmp"
|
setfacl -m u:nginx:X {{ odoo_root_dir }}
|
||||||
remote_src: True
|
setfacl -R -m u:nginx:rX {{ odoo_root_dir }}/data {{ odoo_root_dir }}/app/addons {{ odoo_root_dir }}/app/odoo/addons {{ odoo_root_dir }}/enterprise
|
||||||
|
|
||||||
- name: Copy odoo application to its final directory
|
|
||||||
synchronize:
|
|
||||||
src: "{{ odoo_root_dir }}/tmp/odoo-{{ odoo_version }}.post{{ odoo_build }}/"
|
|
||||||
dest: "{{ odoo_root_dir }}/app/"
|
|
||||||
recursive: True
|
|
||||||
delete: True
|
|
||||||
compress: False
|
|
||||||
delegate_to: "{{ inventory_hostname }}"
|
|
||||||
|
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
|
||||||
|
- when: odoo_install_mode != 'none' and odoo_enterprise
|
||||||
|
block:
|
||||||
|
- name: Clone or update the enterprise repo
|
||||||
|
git:
|
||||||
|
repo: "{{ odoo_enterprise_git_url }}"
|
||||||
|
dest: "{{ odoo_root_dir }}/enterprise"
|
||||||
|
depth: 1
|
||||||
|
version: "{{ odoo_version }}"
|
||||||
|
force: True
|
||||||
|
notify: restart odoo-server
|
||||||
|
tags: odoo
|
||||||
|
|
||||||
|
|
||||||
- name: Create the virtualenv
|
- name: Create the virtualenv
|
||||||
pip:
|
pip:
|
||||||
state: "{{ (odoo_install_mode == 'none') | ternary('present', 'latest') }}"
|
state: "{{ (odoo_install_mode == 'none') | ternary('present', 'latest') }}"
|
||||||
@ -36,7 +43,7 @@
|
|||||||
virtualenv_command: "{{ odoo_venv_command }}"
|
virtualenv_command: "{{ odoo_venv_command }}"
|
||||||
requirements: "{{ odoo_root_dir }}/app/requirements.txt"
|
requirements: "{{ odoo_root_dir }}/app/requirements.txt"
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ (pg_version == 'default') | ternary('', '/usr/pgsql-' ~ pg_version ~ '/bin:') }}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
|
PATH: "{{ (pg_version | default('default') == 'default') | ternary('', '/usr/pgsql-' ~ pg_version ~ '/bin:') }}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
|
||||||
- name: Install additional modules in the venv
|
- name: Install additional modules in the venv
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Write version
|
- name: Write version
|
||||||
copy: content={{ odoo_version }}-{{ odoo_build }} dest={{ odoo_root_dir }}/meta/ansible_version
|
copy: content={{ odoo_version }} dest={{ odoo_root_dir }}/meta/ansible_version
|
||||||
tags: odoo
|
tags: odoo
|
||||||
|
46
roles/odoo/templates/nginx.conf.j2
Normal file
46
roles/odoo/templates/nginx.conf.j2
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name {{ odoo_public_url | default('https://_/') | urlsplit('hostname') }};
|
||||||
|
|
||||||
|
root /usr/share/nginx;
|
||||||
|
|
||||||
|
location /websocket {
|
||||||
|
proxy_pass http://localhost:{{ odoo_longpolling_port }};
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /web/filestore {
|
||||||
|
internal;
|
||||||
|
alias {{ odoo_root_dir }}/filestore;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @odoo {
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_pass http://localhost:{{ odoo_http_port }};
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/[^/]+/static/.+$ {
|
||||||
|
root {{ odoo_root_dir }}/app/addons;
|
||||||
|
try_files {{ odoo_root_dir }}/enterprise$uri {{ odoo_root_dir }}/app/addons$uri {{ odoo_root_dir }}/app/odoo/addons$uri @odoo;
|
||||||
|
expires 24h;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_pass http://localhost:{{ odoo_http_port }};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,12 @@
|
|||||||
[options]
|
[options]
|
||||||
db_name = {{ odoo_db_name }}
|
db_name = {{ odoo_db_name }}
|
||||||
db_host = {{ odoo_db_server }}
|
db_host = {{ odoo_db_server }}
|
||||||
|
db_port = {{ odoo_db_port }}
|
||||||
db_user = {{ odoo_db_user }}
|
db_user = {{ odoo_db_user }}
|
||||||
db_password = {{ odoo_db_pass }}
|
db_password = {{ odoo_db_pass }}
|
||||||
addons_path = {{ odoo_root_dir }}/app/odoo/addons
|
addons_path = {{ odoo_root_dir }}/enterprise, {{ odoo_root_dir }}/app/odoo/addons, {{ odoo_root_dir }}/app/addons
|
||||||
workers = {{ odoo_workers }}
|
workers = {{ odoo_workers }}
|
||||||
|
max_cron_threads = 1
|
||||||
http_port = {{ odoo_http_port }}
|
http_port = {{ odoo_http_port }}
|
||||||
longpolling_port = {{ odoo_longpolling_port }}
|
longpolling_port = {{ odoo_longpolling_port }}
|
||||||
email_from = {{ odoo_email }}
|
email_from = {{ odoo_email }}
|
||||||
@ -12,3 +14,4 @@ smtp_server = localhost
|
|||||||
data_dir = {{ odoo_root_dir }}/data
|
data_dir = {{ odoo_root_dir }}/data
|
||||||
without_demo = ALL
|
without_demo = ALL
|
||||||
init = base
|
init = base
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
odoo_packages:
|
odoo_packages:
|
||||||
- python39-pip
|
- python3.11-pip
|
||||||
- python39-devel
|
- python3.11-devel
|
||||||
- gcc
|
- gcc
|
||||||
- gcc-c++
|
- gcc-c++
|
||||||
- libxml2-devel
|
- libxml2-devel
|
||||||
@ -13,5 +13,7 @@ odoo_packages:
|
|||||||
- tar
|
- tar
|
||||||
- zstd
|
- zstd
|
||||||
- postgresql15 # for pg_dump
|
- postgresql15 # for pg_dump
|
||||||
|
- git
|
||||||
|
- acl
|
||||||
|
|
||||||
odoo_venv_command: /bin/python3.9 -m venv
|
odoo_venv_command: /bin/python3.11 -m venv
|
||||||
|
19
roles/odoo/vars/RedHat-9.yml
Normal file
19
roles/odoo/vars/RedHat-9.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
odoo_packages:
|
||||||
|
- python3.11-pip
|
||||||
|
- python3.11-devel
|
||||||
|
- gcc
|
||||||
|
- gcc-c++
|
||||||
|
- libxml2-devel
|
||||||
|
- libxslt-devel
|
||||||
|
- openldap-devel
|
||||||
|
- postgresql-devel
|
||||||
|
#- nodejs-less
|
||||||
|
- tar
|
||||||
|
- zstd
|
||||||
|
- postgresql15 # for pg_dump
|
||||||
|
- git
|
||||||
|
- acl
|
||||||
|
|
||||||
|
odoo_venv_command: /bin/python3.11 -m venv
|
@ -394,3 +394,4 @@ download.copr.fedorainfracloud.org
|
|||||||
# TrueNAS
|
# TrueNAS
|
||||||
update.ixsystems.com
|
update.ixsystems.com
|
||||||
update.freenas.org
|
update.freenas.org
|
||||||
|
apt.tn.ixsystems.com
|
||||||
|
Loading…
x
Reference in New Issue
Block a user