ansible-nas/tasks/openhab.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

2019-08-13 12:38:15 +00:00
---
- name: Create openHAB group
group:
2019-08-13 13:13:36 +00:00
name: openhab
gid: 9001
2019-08-13 12:38:15 +00:00
state: present
- name: Create openHAB user
user:
2019-08-13 13:13:36 +00:00
name: openhab
uid: 9001
2019-08-13 12:38:15 +00:00
state: present
system: yes
update_password: on_create
create_home: no
2019-08-13 13:13:36 +00:00
group: openhab
2019-08-13 12:38:15 +00:00
- name: Create openHAB Directories
file:
path: "{{ item }}"
state: directory
2019-08-13 13:13:36 +00:00
owner: openhab
2019-08-13 12:38:15 +00:00
group: openhab
with_items:
- "{{ openhab_data_directory }}"
- "{{ openhab_data_directory }}/conf"
- "{{ openhab_data_directory }}/userdata"
- "{{ openhab_data_directory }}/addons"
- name: Create openHAB container
docker_container:
name: openHAB
image: "{{ openhab_docker_image }}"
pull: true
network_mode: "host"
volumes:
- "{{ openhab_data_directory }}/conf:/openhab/conf:rw"
- "{{ openhab_data_directory }}/userdata:/openhab/userdata:rw"
- "{{ openhab_data_directory }}/addons:/openhab/addons:rw"
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
env:
OPENHAB_HTTP_PORT: "{{ openhab_port_http }}"
OPENHAB_HTTPS_PORT: "{{ openhab_port_https }}"
2019-08-13 12:38:15 +00:00
restart_policy: unless-stopped
memory: 1g
labels:
traefik.backend: "openhab"
traefik.frontend.rule: "Host:openhab.{{ ansible_nas_domain }}"
traefik.enable: "{{ openhab_available_externally }}"
traefik.port: "{{ openhab_port_https }}"