Improves organization of tasks
This commit is contained in:
parent
7e60ea7451
commit
436701338f
@ -3,3 +3,5 @@
|
|||||||
user: root
|
user: root
|
||||||
roles:
|
roles:
|
||||||
- odoo
|
- odoo
|
||||||
|
vars:
|
||||||
|
dominio: agofer.net
|
||||||
|
|||||||
17
roles/odoo/tasks/edit-odoo-settings.yml
Normal file
17
roles/odoo/tasks/edit-odoo-settings.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
# Change (via direct database access) some settings from their 'Production'
|
||||||
|
# values
|
||||||
|
|
||||||
|
- name: Copy SQL script with new settings
|
||||||
|
template:
|
||||||
|
src: change-odoo-settings.sql.j2
|
||||||
|
dest: /home/odoo/change-odoo-settings.sql
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Run the update query on the database
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
|
postgresql_query:
|
||||||
|
db: agofer
|
||||||
|
path_to_script: /home/odoo/change-odoo-settings.sql
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
- name: Clone current Odoo code
|
- name: Clone current Odoo code
|
||||||
git:
|
git:
|
||||||
repo: 'ssh://git@gitea.agofer.net:22001/Agofer/odoo14_running_code.git'
|
repo: '{{ sourcecode_location }}'
|
||||||
dest: /opt
|
dest: /opt
|
||||||
depth: 1
|
depth: 1
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
- name: Download and install wkhtmltopdf
|
- name: Download and install wkhtmltopdf
|
||||||
apt:
|
apt:
|
||||||
deb: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb
|
deb: '{{ wkhtmltopdf_location }}'
|
||||||
|
|
||||||
- name: Link wkhtmltopdf scripts
|
- name: Link wkhtmltopdf scripts
|
||||||
file:
|
file:
|
||||||
@ -54,37 +54,11 @@
|
|||||||
- wkhtmltopdf
|
- wkhtmltopdf
|
||||||
- wkhtmltoimage
|
- wkhtmltoimage
|
||||||
|
|
||||||
- name: Create odoo database user
|
- import_tasks: setup-postgresql.yml
|
||||||
become: true
|
|
||||||
become_user: postgres
|
|
||||||
postgresql_user:
|
|
||||||
name: '{{ item }}'
|
|
||||||
role_attr_flags: SUPERUSER
|
|
||||||
loop:
|
|
||||||
- odoo
|
|
||||||
- agofer
|
|
||||||
|
|
||||||
- name: Retrieve database backup
|
- import_tasks: edit-odoo-settings.yml
|
||||||
synchronize:
|
|
||||||
mode: pull
|
|
||||||
compress: no
|
|
||||||
src: rsync://backups.bogota.agofer/db14/db_odoo_agofer.gz
|
|
||||||
dest: /home/odoo/db_odoo_agofer.sql.gz
|
|
||||||
|
|
||||||
- name: Create database
|
- import_tasks: setup-nginx.yml
|
||||||
become: true
|
|
||||||
become_user: postgres
|
|
||||||
postgresql_db:
|
|
||||||
name: agofer
|
|
||||||
owner: odoo
|
|
||||||
|
|
||||||
- name: Restore database from backup
|
|
||||||
become: true
|
|
||||||
become_user: postgres
|
|
||||||
postgresql_db:
|
|
||||||
name: agofer
|
|
||||||
state: restore
|
|
||||||
target: /home/odoo/db_odoo_agofer.sql.gz
|
|
||||||
|
|
||||||
- name: Configure Odoo log rotation
|
- name: Configure Odoo log rotation
|
||||||
copy:
|
copy:
|
||||||
@ -92,36 +66,6 @@
|
|||||||
dest: /etc/logrotate.d/odoo
|
dest: /etc/logrotate.d/odoo
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
- name: Configure Nginx
|
|
||||||
copy:
|
|
||||||
src: custom_502.html
|
|
||||||
dest: /etc/nginx/custom_502.html
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- copy:
|
|
||||||
src: nginx.conf
|
|
||||||
dest: /etc/nginx/sites-available/odoo14
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- file:
|
|
||||||
state: link
|
|
||||||
src: /etc/nginx/sites-available/odoo14
|
|
||||||
dest: /etc/nginx/sites-enabled/odoo14
|
|
||||||
|
|
||||||
- file:
|
|
||||||
state: link
|
|
||||||
src: /etc/nginx/custom_502.html
|
|
||||||
dest: /usr/share/nginx/html/custom_502.html
|
|
||||||
|
|
||||||
- file:
|
|
||||||
state: absent
|
|
||||||
path: /etc/nginx/sites-enabled/default
|
|
||||||
|
|
||||||
- name: Restart Nginx
|
|
||||||
systemd:
|
|
||||||
name: nginx
|
|
||||||
state: restarted
|
|
||||||
|
|
||||||
- name: Configure Odoo
|
- name: Configure Odoo
|
||||||
template:
|
template:
|
||||||
src: odoo.conf.j2
|
src: odoo.conf.j2
|
||||||
|
|||||||
33
roles/odoo/tasks/setup-nginx.yml
Normal file
33
roles/odoo/tasks/setup-nginx.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Configure Odoo as the only site in the local Nginx http server
|
||||||
|
|
||||||
|
- name: Configure Nginx
|
||||||
|
copy:
|
||||||
|
src: custom_502.html
|
||||||
|
dest: /etc/nginx/custom_502.html
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- copy:
|
||||||
|
src: nginx.conf
|
||||||
|
dest: /etc/nginx/sites-available/odoo14
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- file:
|
||||||
|
state: link
|
||||||
|
src: /etc/nginx/sites-available/odoo14
|
||||||
|
dest: /etc/nginx/sites-enabled/odoo14
|
||||||
|
|
||||||
|
- file:
|
||||||
|
state: link
|
||||||
|
src: /etc/nginx/custom_502.html
|
||||||
|
dest: /usr/share/nginx/html/custom_502.html
|
||||||
|
|
||||||
|
- file:
|
||||||
|
state: absent
|
||||||
|
path: /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
|
- name: Restart Nginx
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
||||||
|
|
||||||
35
roles/odoo/tasks/setup-postgresql.yml
Normal file
35
roles/odoo/tasks/setup-postgresql.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
# Configure PostgreSQL and import existing Odoo14 database from a backup
|
||||||
|
|
||||||
|
- name: Create odoo database user
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
|
postgresql_user:
|
||||||
|
name: '{{ item }}'
|
||||||
|
role_attr_flags: SUPERUSER
|
||||||
|
loop:
|
||||||
|
- odoo
|
||||||
|
- agofer
|
||||||
|
|
||||||
|
- name: Retrieve database backup
|
||||||
|
synchronize:
|
||||||
|
mode: pull
|
||||||
|
compress: no
|
||||||
|
src: '{{ database_location }}'
|
||||||
|
dest: /home/odoo/db_odoo_agofer.sql.gz
|
||||||
|
|
||||||
|
- name: Create database
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
|
postgresql_db:
|
||||||
|
name: agofer
|
||||||
|
owner: odoo
|
||||||
|
|
||||||
|
- name: Restore database from backup
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
|
postgresql_db:
|
||||||
|
name: agofer
|
||||||
|
state: restore
|
||||||
|
target: /home/odoo/db_odoo_agofer.sql.gz
|
||||||
|
|
||||||
@ -1,34 +1,49 @@
|
|||||||
-- Update production Odoo database to delete remote connection servers
|
-- Update Odoo database with new settings for the current development/testing
|
||||||
-- (email and electronic invoice) and change the password for user sistemas
|
-- install
|
||||||
|
|
||||||
|
-- Change Electronic Invoice settings to prevent invoices from being sent
|
||||||
|
|
||||||
UPDATE "res_company" SET "ei_automatic_gen"=false,"ei_ack_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Acuse_Recibo/',"ei_dian_result_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Dian_result',"ei_write_folder"='/INVOICE/LAB/800216499/800216499_01/IN/',"ei_automatic_read"=false,"ei_error_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Error/',"ei_decision_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Aceptacion_y_rechazo/',"ei_server_type"='test',"xml_automatic_generation"=false,"sftp_url"='fecolab.cen.biz',"ei_voucher_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Comprobantes/' WHERE id IN (1);
|
UPDATE "res_company" SET "ei_automatic_gen"=false,"ei_ack_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Acuse_Recibo/',"ei_dian_result_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Dian_result',"ei_write_folder"='/INVOICE/LAB/800216499/800216499_01/IN/',"ei_automatic_read"=false,"ei_error_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Error/',"ei_decision_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Aceptacion_y_rechazo/',"ei_server_type"='test',"xml_automatic_generation"=false,"sftp_url"='fecolab.cen.biz',"ei_voucher_folder"='/INVOICE/LAB/800216499/800216499_01/OUT/Comprobantes/' WHERE id IN (1);
|
||||||
|
|
||||||
|
-- Deactivate Electronic Invoice periodic checks and downloads
|
||||||
|
|
||||||
UPDATE "ir_cron" SET "active"=false WHERE id IN (25);
|
UPDATE "ir_cron" SET "active"=false WHERE id IN (25);
|
||||||
|
|
||||||
UPDATE "ir_cron" SET "active"=false WHERE id IN (27);
|
UPDATE "ir_cron" SET "active"=false WHERE id IN (27);
|
||||||
|
|
||||||
|
-- Change Client ID for Google OAuth authentication
|
||||||
|
|
||||||
UPDATE "auth_oauth_provider" SET "client_id"='839348907645-51gmj31708h2vuts2sorqh842uhohoce.apps.googleusercontent.com' WHERE id IN (3);
|
UPDATE "auth_oauth_provider" SET "client_id"='839348907645-51gmj31708h2vuts2sorqh842uhohoce.apps.googleusercontent.com' WHERE id IN (3);
|
||||||
|
|
||||||
|
-- Change password for user 'sistemas'
|
||||||
|
|
||||||
UPDATE "res_users" SET "password_crypt"='$pbkdf2-sha512$6400$tnYOAUCoNSbkHKMUAmAMgQ$UTwtQj2mGD1KnW5.S7dq0qxMw5M4tuWb2ckr8vB8k7MLrwG5aDyWDA6sLXawE..xrLDjvYrtxgIRvNf97knYVQ' WHERE id IN (5);
|
UPDATE "res_users" SET "password_crypt"='$pbkdf2-sha512$6400$tnYOAUCoNSbkHKMUAmAMgQ$UTwtQj2mGD1KnW5.S7dq0qxMw5M4tuWb2ckr8vB8k7MLrwG5aDyWDA6sLXawE..xrLDjvYrtxgIRvNf97knYVQ' WHERE id IN (5);
|
||||||
|
|
||||||
UPDATE "res_users" SET "password"='' WHERE id = 5;
|
UPDATE "res_users" SET "password"='' WHERE id = 5;
|
||||||
|
|
||||||
UPDATE "res_users" SET "share"=false WHERE id = 5;
|
UPDATE "res_users" SET "share"=false WHERE id = 5;
|
||||||
|
|
||||||
delete from wkf_instance where res_id=1 and res_type='fetchmail.server';
|
-- Delete incoming and outgoing mail server settings
|
||||||
|
|
||||||
delete from fetchmail_server where id IN (1);
|
DELETE FROM wkf_instance where res_id=1 and res_type='fetchmail.server';
|
||||||
|
|
||||||
delete from wkf_instance where res_id=1 and res_type='ir.mail_server';
|
DELETE FROM fetchmail_server where id IN (1);
|
||||||
|
|
||||||
delete from ir_mail_server where id IN (1);
|
DELETE FROM wkf_instance where res_id=1 and res_type='ir.mail_server';
|
||||||
|
|
||||||
delete from wkf_instance where res_id=4 and res_type='ir.mail_server';
|
DELETE FROM ir_mail_server where id IN (1);
|
||||||
|
|
||||||
delete from ir_mail_server where id IN (4);
|
DELETE FROM wkf_instance where res_id=4 and res_type='ir.mail_server';
|
||||||
|
|
||||||
delete from wkf_instance where res_id=5 and res_type='ir.mail_server';
|
DELETE FROM ir_mail_server where id IN (4);
|
||||||
|
|
||||||
delete from ir_mail_server where id IN (5);
|
DELETE FROM wkf_instance where res_id=5 and res_type='ir.mail_server';
|
||||||
|
|
||||||
|
DELETE FROM ir_mail_server where id IN (5);
|
||||||
|
|
||||||
|
DELETE FROM ir_model_data where id IN (1576);
|
||||||
|
|
||||||
|
-- Change base URL
|
||||||
|
|
||||||
|
UPDATE "ir_config_parameter" SET "value"='https://{{ ansible_hostname }}.{{ dominio }}' WHERE id IN (5);
|
||||||
|
|
||||||
delete from ir_model_data where id IN (1576);
|
|
||||||
@ -9,8 +9,8 @@ db_user = odoo
|
|||||||
db_name = agofer
|
db_name = agofer
|
||||||
list_db = True
|
list_db = True
|
||||||
dbfilter = ^agofer$
|
dbfilter = ^agofer$
|
||||||
addons_path = /opt/odoo/odoo/addons,/opt/odoo/community/addons,/opt/odoo/extended,/opt/odoo/vendor
|
addons_path = /opt/odoo/core/addons,/opt/odoo/community,/opt/odoo/custom,/opt/odoo/vendor
|
||||||
without_demo = True
|
without_demo = all
|
||||||
test_enable = False
|
test_enable = False
|
||||||
timezone = America/Bogota
|
timezone = America/Bogota
|
||||||
unaccent = True
|
unaccent = True
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
adminpass: '{{ vault_adminpass }}'
|
adminpass: '{{ vault_adminpass }}'
|
||||||
|
|
||||||
|
wkhtmltopdf_location: 'https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb'
|
||||||
|
|
||||||
|
sourcecode_location: 'ssh://git@gitea.agofer.net:22001/Agofer/odoo14_running_code.git'
|
||||||
|
|
||||||
|
database_location: 'rsync://backups.bogota.agofer/db14/db_odoo_agofer.gz'
|
||||||
|
|
||||||
apt_packages:
|
apt_packages:
|
||||||
- build-essential
|
- build-essential
|
||||||
- nginx
|
- nginx
|
||||||
@ -41,3 +47,4 @@ python_packages:
|
|||||||
- setuptools
|
- setuptools
|
||||||
- wheel
|
- wheel
|
||||||
- paramiko
|
- paramiko
|
||||||
|
- pdfminer
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user