tt-rss/tasks/database_postgres.yml
2020-09-08 23:32:56 +02:00

30 lines
790 B
YAML

- 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
template: template0
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