diff --git a/roles/odoo/files/remove_remote_connections.sql b/roles/odoo/files/remove_remote_connections.sql new file mode 100644 index 0000000..061e4e2 --- /dev/null +++ b/roles/odoo/files/remove_remote_connections.sql @@ -0,0 +1,34 @@ +-- Update production Odoo database to delete remote connection servers +-- (email and electronic invoice) and change the password for user sistemas + +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 "ir_cron" SET "active"=false WHERE id IN (25); + +UPDATE "ir_cron" SET "active"=false WHERE id IN (27); + +UPDATE "auth_oauth_provider" SET "client_id"='839348907645-51gmj31708h2vuts2sorqh842uhohoce.apps.googleusercontent.com' WHERE id IN (3); + +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 "share"=false WHERE id = 5; + +delete from wkf_instance where res_id=1 and res_type='fetchmail.server'; + +delete from fetchmail_server where id IN (1); + +delete from wkf_instance where res_id=1 and res_type='ir.mail_server'; + +delete from ir_mail_server where id IN (1); + +delete from wkf_instance where res_id=4 and res_type='ir.mail_server'; + +delete from ir_mail_server where id IN (4); + +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); diff --git a/roles/odoo/tasks/main.yml b/roles/odoo/tasks/main.yml index ae767fa..7003da2 100644 --- a/roles/odoo/tasks/main.yml +++ b/roles/odoo/tasks/main.yml @@ -75,3 +75,36 @@ - wkhtmltopdf - wkhtmltoimage +- name: Create odoo database user + postgresql_user: + name: '{{ item }}' + role_attr_flags: SUPERUSER + loop: + - odoo + - agofer + +- name: Retrieve database backup + synchronize: + mode: pull + existing_only: yes + src: rsync://backups.bogota.agofer/db/latest_Agofer.gz + dest: /home/odoo/latest_Agofer.gz + +-name: Create and restore database + postgresql_db: + name: Agofer + owner: odoo + state: restore + target: /home/odoo/latest_Agofer.gz + +- name: Copy SQL script that disconnects Odoo from email and ftp servers + copy: + src: remove_remote_connections.sql + dest: /home/odoo/remove_remote_connections.sql + mode: '0644' + +- name: Update database to remove connection to servers + postgresql_query: + db: Agofer + path_to_script: /home/odoo/remove_remote_connections.sql +