adapt tt-rss

This commit is contained in:
vincent 2020-09-08 21:18:56 +02:00
parent 63c532aef1
commit fc9210debb
4 changed files with 56 additions and 1 deletions

View File

@ -1,6 +1,7 @@
---
# defaults file for tt-rss
# Database user
ttrss_db_type: postgres #postgres or mysql
ttrss_db_user: ttrss
# Database password, please change when using the role
ttrss_db_password: ttrss

25
tasks/database_mysql.yml Normal file
View File

@ -0,0 +1,25 @@
- name: "Ensure database is present"
become: yes
mysql_db:
name: "{{ ttrss_db_name }}"
collation: utf8_general_ci
encoding: utf8
state: present
register: ttrss_database_creation
- name: import DATA in database in case of creation
become: yes
mysql_db:
name: "{{ ttrss_db_name }}"
state: import
target: "{{ttrss_SQl_target_file}}"
when: ttrss_database_creation.changed == true and ttrss_SQl_target_file is defined
- name: "Ensure db user is present"
become: yes
mysql_user:
name: "{{ ttrss_db_user }}"
host: localhost
password: "{{ ttrss_db_password }}"
priv: "{{ ttrss_db_name }}.*:ALL"
state: present

View File

@ -0,0 +1,29 @@
- name: "Ensure db user is present"
become: yes
become_user: postgres
postgresql_user:
name: "{{ ttrss_db_user }}"
password: "{{ ttrss_db_password }}"
state: present
- name: "Ensure database is present"
become: yes
become_user: postgres
postgresql_db:
name: "{{ ttrss_db_name }}"
lc_collate: fr_FR.UTF-8
encoding: utf8
owner: "{{ ttrss_db_user }}"
state: present
register: ttrss_database_creation
- name: import DATA in database in case of creation
become: yes
become_user: postgres
postgresql_db:
name: "{{ ttrss_db_name }}"
state: restore
target: "{{ ttrss_SQl_target_file }}"
register: ttrss_database_import
when: ttrss_database_creation.changed == true and ttrss_SQl_target_file is defined

View File

@ -2,7 +2,7 @@
// *******************************************
// *** Database configuration (important!) ***
// *******************************************
define('DB_TYPE', 'mysql');
define('DB_TYPE', '{{ ttrss_db_type}}');
define('DB_HOST', 'localhost');
define('DB_USER', '{{ ttrss_db_user}}');
define('DB_NAME', '{{ttrss_db_name}}');