28 lines
672 B
YAML
28 lines
672 B
YAML
|
|
||
|
- name: "Ensure database is present"
|
||
|
become: yes
|
||
|
mysql_db:
|
||
|
name: "{{ hass_db_name }}"
|
||
|
collation: utf8mb4_unicode_ci
|
||
|
encoding: utf8mb4
|
||
|
state: present
|
||
|
register: hass_database_creation
|
||
|
|
||
|
|
||
|
- name: import DATA in database in case of creation
|
||
|
become: yes
|
||
|
mysql_db:
|
||
|
name: "{{ hass_db_name }}"
|
||
|
state: import
|
||
|
target: "{{ hass_SQl_target_file }}"
|
||
|
when: hass_database_creation.changed == true and hass_SQl_target_file is defined
|
||
|
|
||
|
- name: "Ensure db user is present"
|
||
|
become: yes
|
||
|
mysql_user:
|
||
|
name: "{{ hass_db_user }}"
|
||
|
host: localhost
|
||
|
password: "{{ hass_db_password }}"
|
||
|
priv: "{{ hass_db_name }}.*:ALL"
|
||
|
state: present
|