diff options
-rw-r--r-- | dan/ele-helene.yml | 1 | ||||
-rw-r--r-- | inventory/host_vars/ele-helene.yml | 12 | ||||
-rw-r--r-- | roles/streaming/handbrake/defaults/main.yml | 12 | ||||
-rw-r--r-- | roles/streaming/handbrake/tasks/main.yml | 25 | ||||
-rw-r--r-- | roles/streaming/handbrake/templates/pod-spec.yml.j2 | 59 |
5 files changed, 109 insertions, 0 deletions
diff --git a/dan/ele-helene.yml b/dan/ele-helene.yml index 609bc015..dbf7bf61 100644 --- a/dan/ele-helene.yml +++ b/dan/ele-helene.yml @@ -18,3 +18,4 @@ - role: streaming/blackmagic/desktopvideo - role: kubernetes/base - role: kubernetes/standalone/base + - role: streaming/handbrake diff --git a/inventory/host_vars/ele-helene.yml b/inventory/host_vars/ele-helene.yml index 37fbbb38..cd0ab0d2 100644 --- a/inventory/host_vars/ele-helene.yml +++ b/inventory/host_vars/ele-helene.yml @@ -86,3 +86,15 @@ kubernetes_version: 1.24.3 kubernetes_container_runtime: docker kubernetes_standalone_max_pods: 42 kubernetes_standalone_cni_variant: with-portmap + + +handbrake_storage: + type: lvm + vg: "{{ host_name }}" + lv: handbrake + size: 100G + fs: ext4 + +handbrake_inst_name: emc +handbrake_image_version: v1.25.1 +handbrake_enable_hardware_encoding: yes diff --git a/roles/streaming/handbrake/defaults/main.yml b/roles/streaming/handbrake/defaults/main.yml new file mode 100644 index 00000000..8404f0d6 --- /dev/null +++ b/roles/streaming/handbrake/defaults/main.yml @@ -0,0 +1,12 @@ +--- +# handbrake_storage: +# type: (lvm|zfs) +# ... +handbrake_base_path: /srv/handbrake + +# handbrake_inst_name: transcoder +# handbrake_image_version: v1.25.1 +handbrake_enable_hardware_encoding: no + +handbrake_web_port: 5800 +handbrake_timezone: Europe/Vienna diff --git a/roles/streaming/handbrake/tasks/main.yml b/roles/streaming/handbrake/tasks/main.yml new file mode 100644 index 00000000..75579d89 --- /dev/null +++ b/roles/streaming/handbrake/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: prepare handbrake storage volume + when: handbrake_storage is defined + vars: + storage_volume: "{{ handbrake_storage | combine({'dest': handbrake_base_path}) }}" + include_role: + name: "storage/{{ handbrake_storage.type }}/volume" + +- name: create handbrake instance directories + loop: + - config + - storage + - watch + - output + file: + path: "{{ handbrake_base_path }}/{{ handbrake_inst_name }}/{{ item }}" + state: directory + +- name: install pod manifest + vars: + kubernetes_standalone_pod: + name: "handbrake-{{ handbrake_inst_name }}" + spec: "{{ lookup('template', 'pod-spec.yml.j2') }}" + include_role: + name: kubernetes/standalone/pod diff --git a/roles/streaming/handbrake/templates/pod-spec.yml.j2 b/roles/streaming/handbrake/templates/pod-spec.yml.j2 new file mode 100644 index 00000000..5f321864 --- /dev/null +++ b/roles/streaming/handbrake/templates/pod-spec.yml.j2 @@ -0,0 +1,59 @@ +containers: +- name: handbrake + image: jlesage/handbrake:{{ handbrake_image_version }} + imagePullPolicy: Always + terminationGracePeriodSeconds: 120 + securityContext: + privileged: true + env: + - name: USER_ID + value: '990' + - name: GROUP_ID + value: '990' + - name: SUP_GROUP_IDS + value: '44' + - name: KEEP_APP_RUNNING + value: '1' + - name: TZ + value: '{{ handbrake_timezone }}' + + volumeMounts: +{% if handbrake_enable_hardware_encoding %} + - name: dri-device + mountPath: /dev/dri +{% endif %} + - name: config + mountPath: /config + - name: storage + mountPath: /storage + readOnly: yes + - name: watch + mountPath: /watch + - name: output + mountPath: /output + ports: + - containerPort: 5800 + hostPort: {{ handbrake_web_port }} + +volumes: +{% if handbrake_enable_hardware_encoding %} +- name: dri-device + hostPath: + path: /dev/dri +{% endif %} +- name: config + hostPath: + path: "{{ handbrake_base_path }}/{{ handbrake_inst_name }}/config" + type: Directory +- name: storage + hostPath: + path: "{{ handbrake_base_path }}/{{ handbrake_inst_name }}/storage" + type: Directory +- name: watch + hostPath: + path: "{{ handbrake_base_path }}/{{ handbrake_inst_name }}/watch" + type: Directory +- name: output + hostPath: + path: "{{ handbrake_base_path }}/{{ handbrake_inst_name }}/output" + type: Directory |