2020-09-08 17:27:15 +00:00
|
|
|
- name: "Ensure db user is present"
|
|
|
|
become: yes
|
|
|
|
become_user: postgres
|
|
|
|
postgresql_user:
|
|
|
|
name: "{{ nextcloud_db_user }}"
|
|
|
|
password: "{{ nextcloud_db_password }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: "Ensure database is present"
|
|
|
|
become: yes
|
|
|
|
become_user: postgres
|
|
|
|
postgresql_db:
|
|
|
|
name: "{{ nextcloud_db_name }}"
|
|
|
|
lc_collate: fr_FR.UTF-8
|
|
|
|
encoding: utf8
|
2020-09-08 21:32:56 +00:00
|
|
|
template: template0
|
2020-09-08 17:27:15 +00:00
|
|
|
owner: "{{ nextcloud_db_user }}"
|
|
|
|
state: present
|
|
|
|
register: nextcloud_database_creation
|
|
|
|
|
|
|
|
|
|
|
|
- name: import DATA in database in case of creation
|
|
|
|
become: yes
|
|
|
|
become_user: postgres
|
|
|
|
postgresql_db:
|
|
|
|
name: "{{ nextcloud_db_name }}"
|
|
|
|
state: restore
|
|
|
|
target: "{{ nextcloud_SQl_target_file }}"
|
|
|
|
register: nextcloud_database_import
|
|
|
|
when: nextcloud_database_creation.changed == true and nextcloud_SQl_target_file is defined
|