ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit c4a5573ba83e76f5d4d701bf46f5d971f469a435
parent 9fbf5e6b23ccd93e17fe70e7ff1cba70d6a90554
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 23 Feb 2021 15:43:19 +0100

update roles and configuration
4 files changed, 280 insertions(+), 4 deletions(-)
M
configuration/joguhrtbecher.yml
|
17
+++++++++++++++++
M
configuration/lollo.yml
|
258
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
M
configuration/wanderduene.yml
|
5
+++++
M
playbook.yml
|
4
++--
diff --git a/configuration/joguhrtbecher.yml b/configuration/joguhrtbecher.yml
@@ -103,6 +103,23 @@ services:
   prometheus_node_exporter:
     enable: true
 
+  mariadb:
+    enable: true
+    databases:
+      - name: db1
+      - name: db2
+    users:
+      - username: test1
+        password: test1
+        state: present
+        privileges:
+          "db1.*": "ALL,GRANT"
+          "db2.*": "ALL,GRANT"
+      - username: test2
+        password: test2
+        state: present
+        privileges:
+         "db2.*": "ALL,GRANT"
 
   syncthing:
     enable: true
diff --git a/configuration/lollo.yml b/configuration/lollo.yml
@@ -352,13 +352,267 @@ services:
       - test_powermeters
       - test_sensors
 
+  mosquitto:
+    enable: true
+    enableAnonymousLogin: true
+
+  zigbee2mqtt:
+    enable: true
+    config:
+      homeassistant: false
+      permit_join: false
+      mqtt:
+        base_topic: zigbee2mqtt
+        server: 'mqtt://127.0.0.1'
+      serial:
+        port: /dev/ttyACM0
+        disable_led: true
+      frontend:
+        port: 8422
+        host: 0.0.0.0
+      advanced:
+        ikea_ota_use_test_url: true
+        log_level: warn
+        log_output:
+          - console
+        network_key:
+          - 151
+          - 53
+          - 144
+          - 35
+          - 165
+          - 3
+          - 110
+          - 254
+          - 114
+          - 158
+          - 84
+          - 52
+          - 29
+          - 5
+          - 62
+          - 223
+      devices:
+        '0x842e14fffe977bfa':
+          friendly_name: ikea_remote
+        '0x842e14fffe57daae':
+          friendly_name: ikea_lamp_rgb
+        '0x680ae2fffef92af5':
+          friendly_name: ikea_lamp_whitespectrum
+        '0x842e14fffe5ea4b3':
+          friendly_name: ikea_lamp_switchable
+        '0x588e81fffebcdc1e':
+          friendly_name: ikea_control_outlet
+      groups:
+        '1':
+          friendly_name: deckenlicht
+          retain: false
+          transition: 2
+          optimistic: true
+          devices:
+            - ikea_lamp_rgb
+            - ikea_lamp_whitespectrum
+            - ikea_lamp_switchable
+
+
   mbusd:
     enable: true
     device: modbus0
- 
+
+  serial2tcp:
+    enable: true
+    device: tempsensors0
+
   smartied:
     enable: true
-    configFile: config-files/smartied.json
+    config:
+      devices:
+        modbus-10:
+          type: RelayBoard
+          firstRegister: 0
+          count: 4
+          address: 10
+        modbus-20:
+          type: RelayBoard
+          firstRegister: 0
+          count: 4
+          address: 20
+        modbus-50:
+          type: PowerMeter
+          model: SDM120
+          address: 50
+        modbus-60:
+          type: PowerMeter
+          model: SDM120
+          address: 60
+        tradfri-lamp1:
+          type: Zigbee2MqttLamp
+          lampType: RGB
+          deviceName: ikea_lamp_rgb
+        tradfri-lamp2:
+          type: Zigbee2MqttLamp
+          lampType: WhiteSpectrum
+          deviceName: ikea_lamp_whitespectrum
+        tradfri-lamp3:
+          type: Zigbee2MqttLamp
+          lampType: Switchable
+          deviceName: ikea_lamp_switchable
+        tradfri-relay1:
+          type: Zigbee2MqttRelay
+          deviceName: ikea_control_outlet
+        tradfri-remote1:
+          type: Zigbee2MqttRemote
+          deviceName: ikea_remote
+          actions:
+            toggle:
+              type: SwitchStateAction
+              deviceName: modbus-10
+              relay: 0
+              toggle: true
+            toggle_hold:
+              type: SwitchStateAction
+              deviceName: modbus-10
+              relay: 2
+              toggle: true
+            arrow_left_click:
+              type: SwitchStateAction
+              deviceName: modbus-10
+              relay: 1
+              toggle: true
+            arrow_right_click:
+              type: SwitchStateAction
+              deviceName: modbus-10
+              relay: 3
+              toggle: true
+            brightness_up_click:
+              type: SwitchStateAction
+              deviceName: modbus-20
+              relay: 0
+              toggle: true
+            brightness_down_click:
+              type: SwitchStateAction
+              deviceName: modbus-20
+              relay: 2
+              toggle: true
+            brightness_down_hold:
+              type: SwitchStateAction
+              deviceName: modbus-20
+              relay: 3
+              toggle: true
+        lacrosse-raum:
+          type: LacrosseTempSensor
+          id: '21'
+        lacrosse-kuehlschrank:
+          type: LacrosseTempSensor
+          id: 3a
+        lacrosse-draussen:
+          type: LacrosseTempSensor
+          id: '26'
+        lacrosse-bad:
+          type: LacrosseTempSensor
+          id: 3f
+      clientConfigs:
+        smarthome-pwa:
+          views:
+          - url: lights
+            name: Lights
+            icon: lightbulb
+            type: switches
+            switches:
+            - name: Decke (abgedunkelt)
+              device: modbus-10
+              relay: 0
+            - name: Decke
+              device: modbus-10
+              relay: 2
+            - name: Küche
+              device: modbus-10
+              relay: 1
+            - name: Bett
+              device: modbus-10
+              relay: 3
+            - name: Bad
+              device: modbus-20
+              relay: 0
+            - name: 'Decke: RGB'
+              device: tradfri-lamp1
+              relay: 0
+            - name: 'Decke: Weiß-Spektrum'
+              device: tradfri-lamp2
+              relay: 0
+            - name: 'Decke: Schaltbar'
+              device: tradfri-lamp3
+              relay: 0
+          - url: switches
+            name: Switches
+            icon: power_settings_new
+            type: switches
+            switches:
+            - name: Lüfter
+              device: modbus-20
+              relay: 3
+            - name: Lüfter (leise)
+              device: modbus-20
+              relay: 2
+            - name: Tradfri Steckdose
+              device: tradfri-relay1
+              relay: 0
+          - url: powermeter
+            name: Power Meter
+            icon: power
+            type: powermeter
+            meters:
+            - name: Sonstiges
+              device: modbus-50
+            - name: Küche
+              device: modbus-60
+          - url: temperature
+            name: Temperature
+            icon: brightness_7
+            type: temperature
+            sensors:
+            - name: Kühlschrank
+              device: lacrosse-kuehlschrank
+            - name: Raum
+              device: lacrosse-raum
+            - name: Bad
+              device: lacrosse-bad
+            - name: Draussen
+              device: lacrosse-draussen
+          - url: departures
+            name: Departures
+            icon: departure_board
+            type: departures
+            source: https://f2k1.de/haltestellen.php
+          - url: fritzbox
+            name: Fritz!Box
+            icon: router
+            type: redirect
+            destination: http://192.168.178.1/
+          - url: settings
+            name: Settings
+            icon: settings
+            type: settings
+            sourceLink: https://cgit.ctu.cx/smarthome-pwa
+      serverConfig:
+        frontendPort: 5000
+        modbus:
+          host: 10.0.0.1
+          port: 502
+        mqtt:
+          host: 10.0.0.1
+          port: 1883
+        lacrosse:
+          host: 10.0.0.1
+          port: 2342
+        influx:
+          host: 10.0.0.1
+          port: 8086
+          powermetersDatabase: powermeters
+          sensorsDatabase: sensors
+        powermeterUpdateIntervalSec: 20
+        accessToken: penis123
+
     nginx:
       enable: true
       domain: "home.ctu.cx"
diff --git a/configuration/wanderduene.yml b/configuration/wanderduene.yml
@@ -239,6 +239,11 @@ services:
               auth_basic "Restricted Content";
               auth_basic_user_file /etc/nginx/passwd/print;
             '
+          - path: "/cypro-dispenser"
+            extraConfig: '
+              autoindex on;
+              autoindex_exact_size off;
+            '
       repo.f2k1.de:
         ssl:
           enable: true
diff --git a/playbook.yml b/playbook.yml
@@ -91,6 +91,8 @@
       tags: systemd-networkd
     - role: files             # supports: alpine, arch
       tags: files
+    - role: mariadb
+      tags: mariadb
     - role: acme-redirect
       tags: acme-redirect
     - role: nginx             # supports: alpine, arch

@@ -128,7 +130,5 @@
         - frpc
     - role: influxdb
       tags: [ influxdb, smarthome ]
-    - role: mbusd
-      tags: [ mbusd, smarthome ]
     - role: smartied
       tags: [ smartied, smarthome ]