/
/
/
Ansible role that deploys my edge device with connectivity containers. Currently it deploys a thread border router via the zbt-1 dongle by Home Assistant, a zigbee2MQTT interface using the Sonoff zigbee dongle and a DSMR reader with a generic P1 to USB converter.
1---
2
3- name: Create compose dir for OTBR
4 ansible.builtin.file:
5 path: "{{ otbr_compose_dir }}"
6 state: directory
7 owner: root
8 group: root
9 mode: "0755"
10
11- name: Render OTBR compose
12 ansible.builtin.template:
13 src: otbr-docker-compose.yml.j2
14 dest: "{{ otbr_compose_dir }}/docker-compose.yml"
15 mode: "0664"
16
17- name: Bring up OTBR
18 community.docker.docker_compose_v2:
19 project_src: "{{ otbr_compose_dir }}"
20 state: present
21
22# Optional: pre-provision dataset if you chose dataset.active=true
23- name: Initialize Thread dataset (optional)
24 when: otbr.dataset.active | bool
25 ansible.builtin.shell: |
26 docker exec otbr sh -c '
27 ot-ctl dataset init new &&
28 ot-ctl dataset networkname "{{ otbr.dataset.network_name }}" &&
29 ot-ctl dataset panid {{ otbr.dataset.panid }} &&
30 ot-ctl dataset extpanid {{ otbr.dataset.extpanid }} &&
31 ot-ctl dataset channel {{ otbr.dataset.channel }} &&
32 ot-ctl dataset networkkey {{ otbr.dataset.network_key }} &&
33 ot-ctl dataset commit active &&
34 ot-ctl ifconfig up &&
35 ot-ctl thread start
36 '
37 args:
38 warn: false
39 changed_when: false
40
41