1.1 KiB · text History e832e77
# A reusable fragment. Hosts pull it in with:
#   include = ["include/<this-id>.toml"]

# Ensure the config volume mount target exists before the container starts
# (directories reconcile before files/services).
[[directories]]
path = "/mnt/hass"
mode = "0750"

[[files]]
path = "/etc/containers/systemd/hass.container"
mode = "0644"
content = """
[Unit]
Description=HomeAssistant

[Container]
# Use the centos image
Image=docker.io/homeassistant/home-assistant:stable

# Use volume and network defined below. `:Z` relabels the config dir for
# SELinux (container_file_t) so the container can write to it on enforcing
# hosts. /etc/localtime is a shared system path — do NOT relabel it.
Volume=/mnt/hass:/config:Z
Volume=/etc/localtime:/etc/localtime:ro
Network=host
AutoUpdate=registry

AddCapability=CAP_NET_RAW
AddCapability=CAP_NET_BIND_SERVICE
Volume=/run/dbus:/run/dbus:ro

[Service]
Restart=always
TimeoutStartSec=900

[Install]
# Start by default on boot
WantedBy=multi-user.target default.target
"""

[[services]]
name = "hass.service"
enabled = true
state = "started"