Skip to content

Commit

Permalink
Create an option to switch demo-data on or off
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
raneq committed Jul 3, 2019
1 parent 8c84378 commit 8bf8db3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8bf8db3

Please sign in to comment.