Getting started

Example inventory

To setup and manage Home Assistant on a given host or set of hosts, they need to be added one of the [debops_service_homeassistant.*] Ansible groups in the inventory depending on your way of deployment:

[debops_service_homeassistant_nginx]
hostname

Example playbook

Ansible playbook that uses the debops-contrib.homeassistant role and does not setup a reverse proxy:

---

- name: Setup and manage Home Assistant
  hosts: [ 'debops_service_homeassistant' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: debops-contrib.homeassistant
      tags: [ 'role::homeassistant' ]

Ansible playbook that uses the debops-contrib.homeassistant role together with debops.nginx as reverse proxy:

---

- name: Setup and manage Home Assistant with Nginx as reverse proxy
  hosts: [ 'debops_service_homeassistant_nginx' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: debops.apt_preferences
      tags: [ 'role::apt_preferences' ]
      apt_preferences__dependent_list:
        - '{{ nginx__apt_preferences__dependent_list }}'

    - role: debops.ferm
      tags: [ 'role::ferm' ]
      ferm__dependent_rules:
        - '{{ nginx__ferm__dependent_rules }}'

    - role: debops.nginx
      tags: [ 'role::nginx' ]
      nginx__dependent_maps:
        - '{{ homeassistant__nginx__dependent_maps }}'
      nginx__dependent_upstreams:
        - '{{ homeassistant__nginx__dependent_upstreams }}'
      nginx__dependent_servers:
        - '{{ homeassistant__nginx__dependent_servers }}'

    - role: debops-contrib.homeassistant
      tags: [ 'role::homeassistant' ]

These playbooks are shipped with this role under ./docs/playbooks/ from which you can symlink them to your playbook directory. In case you use multiple DebOps Contrib roles, consider using the DebOps Contrib playbooks.

Ansible tags

You can use Ansible --tags or --skip-tags parameters to limit what tasks are performed during Ansible run. This can be used after a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:

role::homeassistant
Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.
role::homeassistant:pkgs
Tasks related to system package management like installing or removing packages.