Add a POPULAtE_DATABASE env to use an existing wallabag DB

This commit is contained in:
Matthieu Serrepuy
2017-01-16 22:44:43 +01:00
parent e41a237604
commit 2b13ed0703
2 changed files with 10 additions and 4 deletions

View File

@ -29,6 +29,7 @@ Default login is `wallabag:wallabag`.
- `-e SYMFONY__ENV__MAILER_PASSWORD=...`(defaults to "~", the SMTP password) - `-e SYMFONY__ENV__MAILER_PASSWORD=...`(defaults to "~", the SMTP password)
- `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "wallabag@example.com", the address wallabag uses for outgoing emails) - `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "wallabag@example.com", the address wallabag uses for outgoing emails)
- `-e SYMFONY__ENV__FOSUSER_REGISTRATION=...`(defaults to "true", enable or disable public user registration) - `-e SYMFONY__ENV__FOSUSER_REGISTRATION=...`(defaults to "true", enable or disable public user registration)
- `-e POPULATE_DATABASE=...`(defaults to "True". Does the DB has to be populated or is it an existing one)
## SQLite ## SQLite

View File

@ -13,6 +13,7 @@
database_root_user_postgres: "{{ lookup('env', 'POSTGRES_USER') }}" database_root_user_postgres: "{{ lookup('env', 'POSTGRES_USER') }}"
database_root_password_postgres: "{{ lookup('env', 'POSTGRES_PASSWORD') }}" database_root_password_postgres: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER')|default('root', true) }}" database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER')|default('root', true) }}"
populate_database: "{{ lookup('env', 'POPULATE_DATABASE')|default(True, true) }}"
secret: "{{ lookup('env', 'SYMFONY__ENV__SECRET')|default('ovmpmAWXRCabNlMgzlzFXDYmCFfzGv', true) }}" secret: "{{ lookup('env', 'SYMFONY__ENV__SECRET')|default('ovmpmAWXRCabNlMgzlzFXDYmCFfzGv', true) }}"
mailer_host: "{{ lookup('env', 'SYMFONY__ENV__MAILER_HOST')|default('127.0.0.1', true) }}" mailer_host: "{{ lookup('env', 'SYMFONY__ENV__MAILER_HOST')|default('127.0.0.1', true) }}"
mailer_user: "{{ lookup('env', 'SYMFONY__ENV__MAILER_USER')|default('~', true) }}" mailer_user: "{{ lookup('env', 'SYMFONY__ENV__MAILER_USER')|default('~', true) }}"
@ -68,7 +69,8 @@
login_user=root login_user=root
login_password="{{ database_root_password_mariadb }}" login_password="{{ database_root_password_mariadb }}"
notify: run install notify: run install
when: database_driver == 'pdo_mysql' when: (database_driver == 'pdo_mysql') and
(populate_database == True)
- name: add mariadb user - name: add mariadb user
mysql_user: mysql_user:
@ -82,7 +84,8 @@
login_password="{{ database_root_password_mariadb }}" login_password="{{ database_root_password_mariadb }}"
state=present state=present
when: (database_driver == 'pdo_mysql') and when: (database_driver == 'pdo_mysql') and
(database_user != 'root') (database_user != 'root') and
(populate_database == True)
- name: postgresql db - name: postgresql db
postgresql_db: postgresql_db:
@ -93,7 +96,8 @@
login_user="{{ database_root_user_postgres }}" login_user="{{ database_root_user_postgres }}"
login_password="{{ database_root_password_postgres }}" login_password="{{ database_root_password_postgres }}"
notify: run install notify: run install
when: database_driver == 'pdo_pgsql' when: (database_driver == 'pdo_pgsql') and
(populate_database == True)
- name: add postgresql user - name: add postgresql user
postgresql_user: postgresql_user:
@ -107,7 +111,8 @@
login_password="{{ database_root_password_postgres }}" login_password="{{ database_root_password_postgres }}"
state=present state=present
when: (database_driver == 'pdo_pgsql') and when: (database_driver == 'pdo_pgsql') and
(database_user != 'postgres') (database_user != 'postgres') and
(populate_database == True)
- name: remove cache - name: remove cache
file: file: