aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all/ipam.yml3
-rw-r--r--ansible/inventory7
-rw-r--r--ansible/plays/files/zigbee2mqtt/garasjepi/configuration.yaml43
-rw-r--r--ansible/plays/host-garasjepi.yml28
-rw-r--r--ansible/plays/otelcol-contrib.yml29
-rw-r--r--ansible/plays/templates/otelcol-contrib/config.yaml65
-rw-r--r--ansible/plays/zigbee2mqtt-backup.yml13
-rw-r--r--ansible/zigbee2mqtt.yml7
8 files changed, 195 insertions, 0 deletions
diff --git a/ansible/group_vars/all/ipam.yml b/ansible/group_vars/all/ipam.yml
index e025551..0d49b1b 100644
--- a/ansible/group_vars/all/ipam.yml
+++ b/ansible/group_vars/all/ipam.yml
@@ -39,6 +39,7 @@ ipam6:
range: "fdb1:4242:3538:2006::/64"
hosts:
kv24ix: "fdb1:4242:3538:2006::ffff"
+ garasjepi: "fdb1:4242:3538:2005:37df:fafe:392:f991"
hash_dn42:
range: "fdb1:4242:3538:2007::/64"
hosts:
@@ -49,6 +50,8 @@ ipam6:
range: "fdb1:4242:3538:2008::/64"
hosts:
lhn2pi: "fdb1:4242:3538:2008::ffff"
+ lhn2-z2m: "fdb1:4242:3538:2008:9aed:e460:1711:07dd"
+ ha-lhn2: "fdb1:4242:3538:2008:9c59:926f:1dc9:89db"
conflatorio: "fdb1:4242:3538:2008:8042:32ff:fe0c:7161"
danneri: "fdb1:4242:3538:2008:9422:d355:95b7:f170"
unifi: "fdb1:4242:3538:2008:5054:ff:fe4d:96c"
diff --git a/ansible/inventory b/ansible/inventory
index 91e463e..1684d93 100644
--- a/ansible/inventory
+++ b/ansible/inventory
@@ -48,6 +48,8 @@ all:
ansible_host: danneri.dn42.trygvis.io
unifi:
ansible_host: unifi.dn42.trygvis.io
+ garasjepi:
+ ansible_host: garasjepi.dn42.trygvis.io
node1:
ansible_host: 9859f51e-1e3e-4c05-a826-b7fbe18d91be.pub.instances.scw.cloud
@@ -199,4 +201,9 @@ all:
node1:
node2:
+ zigbee2mqtt:
+ hosts:
+ garasjepi:
+ lhn2pi:
+
# vim: set filetype=yaml:
diff --git a/ansible/plays/files/zigbee2mqtt/garasjepi/configuration.yaml b/ansible/plays/files/zigbee2mqtt/garasjepi/configuration.yaml
new file mode 100644
index 0000000..b0b8f5a
--- /dev/null
+++ b/ansible/plays/files/zigbee2mqtt/garasjepi/configuration.yaml
@@ -0,0 +1,43 @@
+homeassistant:
+ enabled: false
+frontend:
+ enabled: true
+mqtt:
+ base_topic: zigbee2mqtt
+ #server: mqtt://ha-kv24.dn42.trygvis.io
+ server: mqtt://192.168.10.159
+ user: z2m
+ password: zigbee2mqtt
+ version: 5
+serial:
+ port: /dev/ttyACM0
+ adapter: deconz
+advanced:
+ network_key:
+ - 107
+ - 142
+ - 62
+ - 67
+ - 150
+ - 226
+ - 182
+ - 69
+ - 47
+ - 194
+ - 244
+ - 95
+ - 73
+ - 125
+ - 135
+ - 61
+ pan_id: 43701
+ ext_pan_id:
+ - 181
+ - 224
+ - 197
+ - 29
+ - 98
+ - 176
+ - 205
+ - 241
+version: 4 \ No newline at end of file
diff --git a/ansible/plays/host-garasjepi.yml b/ansible/plays/host-garasjepi.yml
new file mode 100644
index 0000000..62b0b3d
--- /dev/null
+++ b/ansible/plays/host-garasjepi.yml
@@ -0,0 +1,28 @@
+- hosts:
+ - garasjepi
+ tasks:
+ # These first
+ - become: yes
+ apt:
+ name:
+ - etckeeper
+ - git
+
+ - become: yes
+ apt:
+ name:
+ - tmux
+ - aptitude
+
+# - import_role:
+# name: timezone
+#
+# - import_role:
+# name: systemd-networkd
+
+ - become: yes
+ apt:
+ name:
+ - docker.io
+ - tmux
+ - aptitude
diff --git a/ansible/plays/otelcol-contrib.yml b/ansible/plays/otelcol-contrib.yml
new file mode 100644
index 0000000..f667337
--- /dev/null
+++ b/ansible/plays/otelcol-contrib.yml
@@ -0,0 +1,29 @@
+- hosts:
+ - coregonus
+ - hash
+ - knot
+ tasks:
+
+ # otelcol-contrib.deb needs to be installed first
+ # adduser otelcol-contrib systemd-journal
+
+ - name: /etc/otelcol-contrib/config.yaml
+ become: yes
+ template:
+ src: otelcol-contrib/config.yaml
+ dest: /etc/otelcol-contrib/config.yaml
+ notify: systemctl restart otelcol-contrib
+
+ - name: mkdir /var/lib/otelcol/file_storage
+ become: yes
+ file:
+ path: /var/lib/otelcol/file_storage
+ owner: otelcol-contrib
+ notify: systemctl restart otelcol-contrib
+
+ handlers:
+ - name: systemctl restart otelcol-contrib
+ become: yes
+ systemd:
+ service: otelcol-contrib
+ state: restarted
diff --git a/ansible/plays/templates/otelcol-contrib/config.yaml b/ansible/plays/templates/otelcol-contrib/config.yaml
new file mode 100644
index 0000000..671dbaa
--- /dev/null
+++ b/ansible/plays/templates/otelcol-contrib/config.yaml
@@ -0,0 +1,65 @@
+receivers:
+ journald:
+ priority: debug
+
+exporters:
+ debug:
+ verbosity: detailed
+
+ nop:
+
+ otlphttp/hash:
+ endpoint: https://loki.trygvis.io/otlp
+
+extensions:
+ file_storage/journald:
+
+processors:
+ batch: {}
+
+ transform/severity_parse:
+ log_statements:
+ - context: log
+ statements:
+ - set(resource.attributes["service.namespace"], "systemd")
+ - set(resource.attributes["service.name"], body["_SYSTEMD_UNIT"])
+ - set(resource.attributes["systemd_unit"], body["_SYSTEMD_UNIT"])
+ - set(resource.attributes["systemd_slice"], body["_SYSTEMD_SLICE"])
+ - set(resource.attributes["node"], body["_HOSTNAME"])
+
+ - set(severity_number, SEVERITY_NUMBER_TRACE) where body["PRIORITY"] == "7"
+ - set(severity_text, "debug") where body["PRIORITY"] == "7"
+ - set(severity_number, SEVERITY_NUMBER_DEBUG) where body["PRIORITY"] == "6"
+ - set(severity_text, "info") where body["PRIORITY"] == "6"
+ - set(severity_number, SEVERITY_NUMBER_INFO) where body["PRIORITY"] == "5"
+ - set(severity_text, "notice") where body["PRIORITY"] == "5"
+ - set(severity_number, SEVERITY_NUMBER_WARN) where body["PRIORITY"] == "4"
+ - set(severity_text, "warning") where body["PRIORITY"] == "4"
+ - set(severity_number, SEVERITY_NUMBER_ERROR) where body["PRIORITY"] == "3"
+ - set(severity_text, "err") where body["PRIORITY"] == "3"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "2"
+ - set(severity_text, "crit") where body["PRIORITY"] == "2"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "1"
+ - set(severity_text, "alert") where body["PRIORITY"] == "1"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "0"
+ - set(severity_text, "emerg") where body["PRIORITY"] == "0"
+
+ - set(body, body["MESSAGE"])
+
+service:
+# telemetry:
+# logs:
+# level: debug
+ extensions:
+ - file_storage/journald
+ pipelines:
+ logs:
+ receivers:
+ - journald
+ processors:
+ - transform/severity_parse
+ - batch
+ exporters:
+# - debug
+# - nop
+ - otlphttp/hash
diff --git a/ansible/plays/zigbee2mqtt-backup.yml b/ansible/plays/zigbee2mqtt-backup.yml
new file mode 100644
index 0000000..331045b
--- /dev/null
+++ b/ansible/plays/zigbee2mqtt-backup.yml
@@ -0,0 +1,13 @@
+- hosts:
+ - zigbee2mqtt
+ tasks:
+ - become: yes
+ register: config
+ shell:
+ cmd: |
+ mp=$(docker volume inspect zigbee2mqtt --format '{{"{{.Mountpoint}}"}}')
+ cat $mp/configuration.yaml
+ - copy:
+ content: "{{ config.stdout }}"
+ dest: files/zigbee2mqtt/{{ ansible_hostname }}/configuration.yaml
+ delegate_to: localhost
diff --git a/ansible/zigbee2mqtt.yml b/ansible/zigbee2mqtt.yml
new file mode 100644
index 0000000..3e8e55c
--- /dev/null
+++ b/ansible/zigbee2mqtt.yml
@@ -0,0 +1,7 @@
+- hosts:
+ - zigbee2mqtt
+ roles:
+ - role: docker
+ tags: docker
+ become: yes
+