1
0
Fork 0
home-stack-ansible/roles/home-assistant/tasks/main.yml

45 lines
1.1 KiB
YAML
Raw Normal View History

2024-01-16 22:42:39 +00:00
- name: Download docker repository gpg key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /usr/share/keyrings/docker.asg
- name: Add docker repository
apt_repository:
repo: deb [arch=amd64 signed-by=/usr/share/keyrings/docker.asg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
- name: Install docker
apt:
update_cache: true
name:
- docker-ce
- docker-ce-cli
- python3-docker
- name: Enable docker service
systemd:
name: docker
state: started
enabled: yes
- name: Create home-assistant config directory
file:
path: /opt/homeassistant/config
state: directory
- name: Copy home-assistant config
copy:
src: configuration.yaml
dest: /opt/homeassistant/config/configuration.yaml
- name: Start home-assistant
docker_container:
name: home-assistant
image: ghcr.io/home-assistant/home-assistant:{{ homeassistant.version }}
state: started
restart_policy: unless-stopped
privileged: true
network_mode: host
volumes:
- /opt/homeassistant/config:/config
# - /run/dbus:/run/dbus:ro