corect database issue
This commit is contained in:
parent
2ed1d4d464
commit
ab957eaa03
@ -2,10 +2,15 @@
|
|||||||
# defaults file for hass
|
# defaults file for hass
|
||||||
|
|
||||||
hass_python_package:
|
hass_python_package:
|
||||||
- mysqlclient
|
|
||||||
- homeassistant
|
- homeassistant
|
||||||
- myjdapi
|
- myjdapi
|
||||||
|
|
||||||
|
hass_python_postgres_package:
|
||||||
- psycopg2
|
- psycopg2
|
||||||
|
|
||||||
|
hass_python_Mysql_package:
|
||||||
|
- mysqlclient
|
||||||
|
|
||||||
hass_conf_folder: /var/lib/hass
|
hass_conf_folder: /var/lib/hass
|
||||||
hass_venv_location: /opt/venv/hass
|
hass_venv_location: /opt/venv/hass
|
||||||
hass_db_type: postgres #postgres or mysql
|
hass_db_type: postgres #postgres or mysql
|
||||||
|
@ -25,3 +25,11 @@
|
|||||||
password: "{{ hass_db_password }}"
|
password: "{{ hass_db_password }}"
|
||||||
priv: "{{ hass_db_name }}.*:ALL"
|
priv: "{{ hass_db_name }}.*:ALL"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: install Mysql python module
|
||||||
|
pip:
|
||||||
|
name: "{{hass_python_Mysql_package}}"
|
||||||
|
virtualenv: "{{hass_venv_location}}"
|
||||||
|
virtualenv_command: /usr/bin/python -m venv
|
||||||
|
become: true
|
||||||
|
become_user: "{{hass_username}}"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
password: "{{ hass_db_password }}"
|
password: "{{ hass_db_password }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
||||||
- name: "Ensure database is present"
|
- name: "Ensure database is present"
|
||||||
become: yes
|
become: yes
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
@ -19,6 +20,7 @@
|
|||||||
register: hass_database_creation
|
register: hass_database_creation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: import DATA in database in case of creation
|
- name: import DATA in database in case of creation
|
||||||
become: yes
|
become: yes
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
@ -28,3 +30,11 @@
|
|||||||
target: "{{ hass_SQl_target_file }}"
|
target: "{{ hass_SQl_target_file }}"
|
||||||
register: hass_database_import
|
register: hass_database_import
|
||||||
when: hass_database_creation.changed == true and hass_SQl_target_file is defined
|
when: hass_database_creation.changed == true and hass_SQl_target_file is defined
|
||||||
|
|
||||||
|
- name: install postgres python module
|
||||||
|
pip:
|
||||||
|
name: "{{hass_python_postgres_package}}"
|
||||||
|
virtualenv: "{{hass_venv_location}}"
|
||||||
|
virtualenv_command: /usr/bin/python -m venv
|
||||||
|
become: true
|
||||||
|
become_user: "{{hass_username}}"
|
||||||
|
Loading…
Reference in New Issue
Block a user