Krausmueller.de

Ansible role hass for installing Home Assistant

As described in the last article I use the manual installation of Home Assistant. To get a system up and runing very quick I prefer to use Ansible. For the installatino of Home Assistant I wrote a role. You can find my Ansible role on Github. In the same repository (in the near future) you can also find some other roles which might be useful when installing Home Assistant. The variables whcih can be used to configure the role are described in the README of the role.

A short summary of the steps involved:

  • install required packages (depends on linux distribution)
  • create user for running Home Assistant
  • install Home Assistant to Virtual Environment
  • create and enable systemd start script

A playbook using the role might look similar to this:

1234567
- hosts: hass
  vars:
    hass_version: "0.81.6"
    hass_user: "pi"
    hass_virtualenv: "/srv/hass"
  roles:
     - hass

This playbook would install Home Assistant version 0.81.6 in the directory /srv/hass. Home Assisatnt is installed and executed in the context of the user “pi”.

The role has been tested with Molecule for these linux distributions:

  • Debian 9 Stretch
  • Debian 10 Buster
  • Ubuntu 18.04
  • Ubuntu 18.10
  • Fedora 28
  • Centos 7

In real life the role was only used for installation on a Raspberry Pi running Raspbian (Debian 9 Stretch). But it should work for the other distributions listed as well.