From aacbfb831930a4546e373121785065edc1b35d39 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 4 Apr 2021 04:09:17 +0200 Subject: port streaming/rtmp/streamer to new storage volume roles --- roles/streaming/rtmp/streamer/defaults/main.yml | 5 +++-- roles/streaming/rtmp/streamer/tasks/lvm.yml | 18 ------------------ roles/streaming/rtmp/streamer/tasks/main.yml | 13 ++++++------- roles/streaming/rtmp/streamer/tasks/zfs.yml | 14 -------------- 4 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 roles/streaming/rtmp/streamer/tasks/lvm.yml delete mode 100644 roles/streaming/rtmp/streamer/tasks/zfs.yml (limited to 'roles/streaming') diff --git a/roles/streaming/rtmp/streamer/defaults/main.yml b/roles/streaming/rtmp/streamer/defaults/main.yml index c471e5da..95a2ecc2 100644 --- a/roles/streaming/rtmp/streamer/defaults/main.yml +++ b/roles/streaming/rtmp/streamer/defaults/main.yml @@ -1,6 +1,7 @@ --- -# rtmp_streamer_lvm: -# rtmp_streamer_zfs: +# rtmp_streamer_storage: +# type: (lvm|zfs) +# ... rtmp_streamer_base_path: /srv/rtmp/streamer rtmp_streamer_port: 1935 diff --git a/roles/streaming/rtmp/streamer/tasks/lvm.yml b/roles/streaming/rtmp/streamer/tasks/lvm.yml deleted file mode 100644 index c92d8384..00000000 --- a/roles/streaming/rtmp/streamer/tasks/lvm.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: create logical volume - lvol: - vg: "{{ rtmp_streamer_lvm.vg }}" - lv: "{{ rtmp_streamer_lvm.lv }}" - size: "{{ rtmp_streamer_lvm.size }}" - -- name: create filesystem - filesystem: - fstype: "{{ rtmp_streamer_lvm.fs }}" - dev: "/dev/mapper/{{ rtmp_streamer_lvm.vg | replace('-', '--') }}-{{ rtmp_streamer_lvm.lv | replace('-', '--') }}" - -- name: mount filesytem - mount: - src: "/dev/mapper/{{ rtmp_streamer_lvm.vg | replace('-', '--') }}-{{ rtmp_streamer_lvm.lv | replace('-', '--') }}" - path: "{{ rtmp_streamer_base_path }}" - fstype: "{{ rtmp_streamer_lvm.fs }}" - state: mounted diff --git a/roles/streaming/rtmp/streamer/tasks/main.yml b/roles/streaming/rtmp/streamer/tasks/main.yml index 9c3dd9d6..0e844c72 100644 --- a/roles/streaming/rtmp/streamer/tasks/main.yml +++ b/roles/streaming/rtmp/streamer/tasks/main.yml @@ -1,11 +1,10 @@ --- -- name: prepare rtmp-streamer base path as LVM - when: rtmp_streamer_lvm is defined - import_tasks: lvm.yml - -- name: prepare rtmp-streamer base path as ZFS dataset - when: rtmp_streamer_zfs is defined - import_tasks: zfs.yml +- name: prepare rtmp-streamer storage volume + when: rtmp_streamer_storage is defined + vars: + storage_volume: "{{ rtmp_streamer_storage | combine({'dest': rtmp_streamer_base_path})}}" + include_role: + name: "storage/{{ rtmp_streamer_storage.type }}/volume" - name: create rtmp-streamer instance directory file: diff --git a/roles/streaming/rtmp/streamer/tasks/zfs.yml b/roles/streaming/rtmp/streamer/tasks/zfs.yml deleted file mode 100644 index 74889cbc..00000000 --- a/roles/streaming/rtmp/streamer/tasks/zfs.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: create zfs dataset - zfs: - name: "{{ rtmp_streamer_zfs.pool }}/{{ rtmp_streamer_zfs.name }}" - state: present - extra_zfs_properties: "{{ rtmp_streamer_zfs.properties | default(omit) }}" - -- name: bind mount filesytem - mount: - src: "{{ zfs_pools[rtmp_streamer_zfs.pool].mountpoint }}/{{ rtmp_streamer_zfs.name }}" - path: "{{ rtmp_streamer_base_path }}" - fstype: none - opts: bind,x-systemd.automount,nofail - state: mounted -- cgit v1.2.3