summaryrefslogtreecommitdiff
path: root/dan/ele-hyperion.yml
blob: d2134382a45575e9ce4f6f154a4f4ff60d6a3977 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
- name: Basic Setup
  hosts: ele-hyperion
  roles:
  - role: apt-repo/base
  - role: core/base
  - role: core/sshd/base
  - role: core/zsh
  - role: core/ntp
  - role: core/cpu-microcode

- name: Payload Setup
  hosts: ele-hyperion
  roles:
  - role: apt-repo/obs-studio
  - role: apt-repo/spreadspace
  - role: nginx/base
  - role: monitoring/prometheus/exporter
  - role: ws/base
  - role: core/admin-users
  - role: streaming/blackmagic/desktopvideo
  - role: streaming/blackmagic/mediaexpress
  - role: docker/engine
  post_tasks:
  ## TODO: move to network/netplan when this is done
  - name: install vlan interfaces
    loop: "{{ network.vlans | dict2items }}"
    loop_control:
      label: "{{ item.key }} ({{ item.value | join(',') }})"
    copy:
      dest: "/etc/netplan/20-{{ item.key }}.yaml"
      content: |
        network:
          vlans:
        {% for vlan in item.value %}
        {%   set vlan_ifname = item.key + '.' + (vlan | string) %}
        {%   set vlan_iface = (network.interfaces | selectattr('name', 'eq', vlan_ifname)) %}
            {{ vlan_ifname }}:
              id: {{ vlan }}
              link: {{ item.key }}
        {%   if vlan_iface %}
              addresses:
                - {{ (vlan_iface | first).address }}
        {%   endif %}
        {% endfor %}

  - name: install script to play videos via decklink card
    copy:
      dest: /usr/local/bin/play-video.sh
      mode: 0755
      content: |
        #!/bin/bash

        if [ -z "$1" ]; then
          echo "Usage: $0 <vidoe-file>"
          exit 1
        fi
        video_path_full=$(realpath "$1")
        video_name=$(basename "$video_path_full")

        decklink_device="DeckLink Duo (2)"

        exec docker run --rm -it --device=/dev/blackmagic:/dev/blackmagic -v /usr/lib/libDeckLinkAPI.so:/usr/lib/libDeckLinkAPI.so \
                        -v /usr/lib/libDeckLinkAPI.so:/usr/lib/libDeckLinkAPI.so -v /usr/lib/blackmagic:/usr/lib/blackmagic \
                        -v "$video_path_full:/srv/$video_name" \
                        registry.gitlab.com/spreadspace/docker/ffmpeg:bookworm-decklink12.5-2024-02-18.33 \
                        /usr/bin/ffmpeg -i "/srv/$video_name" -ac 2 -pix_fmt uyvy422 -s 1920x1080 -r 25 -f decklink "$decklink_device"