29 lines
756 B
YAML
29 lines
756 B
YAML
- name: "Ensure db user is present"
|
|
become: yes
|
|
become_user: postgres
|
|
postgresql_user:
|
|
name: "{{ hass_db_user }}"
|
|
password: "{{ hass_db_password }}"
|
|
state: present
|
|
|
|
- name: "Ensure database is present"
|
|
become: yes
|
|
become_user: postgres
|
|
postgresql_db:
|
|
name: "{{ hass_db_name }}"
|
|
lc_collate: fr_FR.UTF-8
|
|
encoding: utf8
|
|
owner: "{{ hass_db_user }}"
|
|
state: present
|
|
register: hass_database_creation
|
|
|
|
|
|
- name: import DATA in database in case of creation
|
|
become: yes
|
|
become_user: postgres
|
|
postgresql_db:
|
|
name: "{{ hass_db_name }}"
|
|
state: restore
|
|
target: "{{ hass_SQl_target_file }}"
|
|
register: hass_database_import
|
|
when: hass_database_creation.changed == true and hass_SQl_target_file is defined |