Files
configpolicy/roles/hassdb/tasks/main.yml
Dustin C. Hatch f1b4598601 roles/hassdb: Deploy Home Assistant database
Normally, Home Assistant uses a SQLite database for storing state
history.  On a Raspberry Pi with only an SD card for storage like
*hass1.pyrocufflink.blue*, this can become extremely slow, especially
for large data sets.  To speed up features like history and logbook,
Home Assistant supports using an external database engine such as
PostgreSQL or MariaDB.

The *hassdb* role and corresponding `hassdb.yml` playbook deploys a
PostgreSQL server for Home Assistant to use.  It needs only to create
the role and database, as Home Assistant manages its own schema.
2020-07-14 11:38:30 -05:00

22 lines
474 B
YAML

- name: ensure psycopg2 is installed
package:
name: python-psycopg2
state: present
tags: install
- name: ensure homeassistant postgresql user exists
become: true
become_user: postgres
postgresql_user:
name: homeassistant
password: '{{ hassdb_password }}'
tags: pg-user
- name: ensure homeassistant postgresql database exists
become: true
become_user: postgres
postgresql_db:
name: homeassistant
owner: homeassistant
tags: pg-db