Skip to content

Instantly share code, notes, and snippets.

@unity
Last active June 17, 2022 08:17
Show Gist options
  • Save unity/d2422f05f67f713c4512bf5eb6d9b998 to your computer and use it in GitHub Desktop.
Save unity/d2422f05f67f713c4512bf5eb6d9b998 to your computer and use it in GitHub Desktop.
Homeassistant-ansible
#########################################################################
# Title: Cloudbox: Homeassistant Role #
# Author(s): l3uddz, desimaniac #
# URL: https://github.com/cloudbox/cloudbox #
# Docker Image: homeassistant/home-assistant #
# -- #
# Part of the Cloudbox project: https://cloudbox.works #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
---
- name: "Set DNS Record on CloudFlare"
include_role:
name: cloudflare
vars:
subdomain: homeassistant
- name: "Create Home-assistant directories"
file: "path={{item}} state=directory mode=0775 owner={{user}} group={{user}}"
with_items:
- "/opt/home-assistant"
- name: "Stop and remove any existing container"
docker_container:
name: homeassistant
state: absent
- name: "Pull Homeassistant Docker image"
docker_image:
name: "homeassistant/home-assistant"
- name: "Create and start container"
docker_container:
name: homeassistant
image: "homeassistant/home-assistant"
pull: yes
published_ports:
- "8123:8123/tcp"
env:
LETSENCRYPT_HOST: "homeassistant.{{domain}}"
LETSENCRYPT_EMAIL: "{{email}}"
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/opt/home-assistant:/config"
# devices: "{{ '/dev/dri:/dev/dri' if dev_dri.stat.exists == True | default(false) else omit }}"
networks:
- name: cloudbox
aliases:
- homeassistant
purge_networks: yes
restart_policy: unless-stopped
state: started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment