xoxys.zigbee2mqtt/templates/services/zigbee2mqtt_compose.yml.j2

91 lines
2.7 KiB
Plaintext
Raw Normal View History

2020-11-29 20:59:41 +00:00
#jinja2:lstrip_blocks: True
{{ ansible_managed | comment }}
version: "2.4"
services:
zigbee2mqtt:
container_name: {{ zigbee2mqtt_container_name }}
image: {{ zigbee2mqtt_image }}
restart: {{ zigbee2mqtt_restart_policy }}
{% if zigbee2mqtt_exposed_ports | default([]) %}
ports:
{% for port in zigbee2mqtt_exposed_ports %}
- {{ port | quote }}
{% endfor %}
{% endif %}
{% if zigbee2mqtt_volumes | default([]) %}
volumes:
{% for volume in zigbee2mqtt_volumes %}
- "{{ volume.name }}:{{ volume.dest }}{% if volume.bind_opt is defined %}:{{ volume.bind_opt }}{% endif %}"
{% endfor %}
{% endif %}
{% if zigbee2mqtt_devices | default([]) %}
devices:
{% for device in zigbee2mqtt_devices %}
- "{{ device.src }}:{{ device.dest }}{% if device.opt is defined %}:{{ device.opt }}{% endif %}"
{% endfor %}
{% endif %}
{% if zigbee2mqtt_networks_applied | default([]) %}
networks:
{% for network in zigbee2mqtt_networks_applied %}
- {{ network }}
{% endfor %}
{% endif %}
{% if zigbee2mqtt_extra_hosts | default([]) %}
extra_hosts:
{% for host in zigbee2mqtt_extra_hosts %}
- {{ host | quote }}
{% endfor %}
{% endif %}
environment:
- TZ={{ zigbee2mqtt_timezone }}
{% if zigbee2mqtt_memory_limit is defined %}
mem_limit: {{ zigbee2mqtt_memory_limit }}
{% endif %}
{% if zigbee2mqtt_memory_reservation is defined %}
mem_reservation: {{ zigbee2mqtt_memory_reservation }}
{% endif %}
{% if zigbee2mqtt_cpu_shares is defined %}
cpu_shares: {{ zigbee2mqtt_cpu_shares }}
{% endif %}
{% if not zigbee2mqtt_cap_add | length == 0 %}
cap_add:
{% for item in zigbee2mqtt_cap_add %}
- {{ item }}
{% endfor %}
{% endif %}
{% if not zigbee2mqtt_cap_drop | length == 0 %}
cap_drop:
{% for item in zigbee2mqtt_cap_drop %}
- {{ item }}
{% endfor %}
{% endif %}
{% if not zigbee2mqtt_security_opt | length == 0 %}
security_opt:
{% for item in zigbee2mqtt_security_opt %}
- {{ item }}
{% endfor %}
{% endif %}
{% if zigbee2mqtt_pids_limit is defined %}
pids_limit: {{ zigbee2mqtt_pids_limit }}
{% endif %}
{% if zigbee2mqtt_volumes | default([]) | rejectattr("bind") | list | length > 0 %}
volumes:
{% for volume in zigbee2mqtt_volumes | rejectattr("bind") %}
{{ volume.name }}:
{% endfor %}
{% endif %}
{% if zigbee2mqtt_networks | default([]) | length > 0 %}
networks:
{% for network in zigbee2mqtt_networks %}
{{ network.name }}:
{% if network.external | default(False) | bool %}
external: true
{% else %}
2020-11-29 20:59:41 +00:00
driver: {{ network.backend | default("bridge") }}
{% endif %}
2020-11-29 20:59:41 +00:00
{% endfor %}
{% endif %}