From 8bf8db30ee26fa2c51105137113478578857e9b3 Mon Sep 17 00:00:00 2001 From: ferran quer Date: Wed, 3 Jul 2019 16:50:52 +0200 Subject: [PATCH 1/2] Create an option to switch demo-data on or off It is `odoo_role_demo_data: false` by default, but can be overriden as other vars, also from the cli like this: ansible-playbook -i "inventory" \ --limit=some-host my_playbook \ --extra-vars="odoo_role_demo_data=true" --- README.md | 2 ++ defaults/main.yml | 2 ++ tasks/main.yml | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5876f3c..6f68791 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ odoo_role_odoo_modules_path: /opt/odoo/modules odoo_role_odoo_db_name: odoo # This not a DB user password, but a password for Odoo to deal with DB. odoo_role_odoo_db_admin_password: 1234 +# Whether to populate db with example data or not. +odoo_role_demo_data: false ``` * Core modules list to install/update diff --git a/defaults/main.yml b/defaults/main.yml index ab819fc..b20ca5a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,3 +39,5 @@ odoo_role_odoo_core_modules: "base" odoo_daemon: "odoo.service" +# Whether to populate db with example data or not. +odoo_role_demo_data: false diff --git a/tasks/main.yml b/tasks/main.yml index 6466f1a..424c258 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -125,7 +125,9 @@ -d {{ odoo_role_odoo_db_name }} --init base --stop-after-init - --without-demo=all + {% if not odoo_role_demo_data %} + --without-demo-data=all + {% endif %} --logfile=/dev/stdout --log-level=warn when: db_initialized.stdout == "0" @@ -158,7 +160,9 @@ -d {{ odoo_role_odoo_db_name }} --init {{ modules_to_install.stdout_lines | join(',') }} --stop-after-init - --without-demo=all + {% if not odoo_role_demo_data %} + --without-demo-data=all + {% endif %} --logfile=/dev/stdout --log-level=warn when: modules_to_install.stdout From 4a33270f5d6926df42ad80308d9dd43aab94c13f Mon Sep 17 00:00:00 2001 From: ferran quer Date: Wed, 3 Jul 2019 18:18:44 +0200 Subject: [PATCH 2/2] fix odoo option --- tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 424c258..dffd2c6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -126,7 +126,7 @@ --init base --stop-after-init {% if not odoo_role_demo_data %} - --without-demo-data=all + --without-demo=all {% endif %} --logfile=/dev/stdout --log-level=warn @@ -161,7 +161,7 @@ --init {{ modules_to_install.stdout_lines | join(',') }} --stop-after-init {% if not odoo_role_demo_data %} - --without-demo-data=all + --without-demo=all {% endif %} --logfile=/dev/stdout --log-level=warn