diff options
Diffstat (limited to '')
-rw-r--r-- | roles/obs/tasks/firefox.yml | 36 | ||||
-rw-r--r-- | roles/obs/tasks/main.yml | 79 | ||||
-rw-r--r-- | roles/obs/tasks/mpv.yml | 38 | ||||
-rw-r--r-- | roles/obs/tasks/obs-from-source.yml | 81 | ||||
-rw-r--r-- | roles/obs/tasks/obs-setup.yml | 37 | ||||
-rw-r--r-- | roles/obs/tasks/pulse.yml | 23 | ||||
-rw-r--r-- | roles/obs/tasks/tigervnc.yml | 54 | ||||
-rw-r--r-- | roles/obs/tasks/user.yml | 25 | ||||
-rw-r--r-- | roles/obs/tasks/xorg.conf | 33 |
9 files changed, 406 insertions, 0 deletions
diff --git a/roles/obs/tasks/firefox.yml b/roles/obs/tasks/firefox.yml new file mode 100644 index 0000000..d96e330 --- /dev/null +++ b/roles/obs/tasks/firefox.yml @@ -0,0 +1,36 @@ +- name: Add Firefox + apt: + name: firefox-esr + when: ansible_distribution == "Debian" +- name: Add Firefox + apt: + name: firefox-esr + when: ansible_distribution == "Ubuntu" +- name: Check if Firefox profiles exist + lineinfile: + dest: "{{ emacsconf_home }}/.mozilla/firefox/profiles.ini" + line: "Name={{ emacsconf_id }}-{{ item.id }}" + check_mode: yes + register: find_profiles + failed_when: no + loop: "{{ emacsconf_tracks }}" +- name: Fail if there are missing profiles + fail: + msg: "Please use firefox -no-remote -CreateProfile {{ emacsconf_id }}-{{ item.item.id }} in an X session to create the profiles." + when: item.changed + loop: "{{ find_profiles.results }}" +- name: Create scripts for tracks + template: + src: firefox-track + dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-firefox" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: 0775 + loop: "{{ emacsconf_tracks }}" + + # - debug: +# var: find_profiles.results +# - name: Create profile if it doesn't exist +# shell: xinit firefox -no-remote -CreateProfile "{{ emacsconf_id }}-{{ item.item.id }}" +# when: item.changed +# loop: "{{ find_profiles.results }}" diff --git a/roles/obs/tasks/main.yml b/roles/obs/tasks/main.yml new file mode 100644 index 0000000..cb981b1 --- /dev/null +++ b/roles/obs/tasks/main.yml @@ -0,0 +1,79 @@ +- name: Load icecast vars + tags: wip + include_vars: + file: ../../stream/defaults/main.yml +- name: Add repo + apt_repository: + repo: ppa:obsproject/obs-studio + when: ansible_distribution == "Ubuntu" +- name: Add packages + apt: + name: + - xserver-xorg-video-dummy + - i3 + - socat + - ffmpeg + - pulseaudio + - jackd2 + - alsa-utils + - dbus-x11 + - obs-studio + - xserver-xorg-dev + update_cache: yes +- name: Set up user + include: user.yml +- name: Set up track bins for addition to paths + file: + path: "{{ emacsconf_home }}/bin/{{ item.id }}" + state: directory + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + loop: "{{ emacsconf_tracks }}" +- name: Copy X11 config + template: + src: xorg.conf + dest: /etc/X11/xorg.conf +- name: Set up VNC + include: tigervnc.yml + tags: vnc, wip +- name: Set up MPV and MPVC + tags: mpv + include: mpv.yml +- name: Set up OBS profiles and scenes + tags: obs-profile + include: obs-setup.yml +- name: Add FFMPEG script for streaming + template: + src: stream-desktop-with-ffmpeg.sh + dest: /home/{{ emacsconf_user }}/bin/{{ item.id }}/stream-desktop-with-ffmpeg + mode: 0775 + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + loop: "{{ emacsconf_tracks }}" +- name: Copy logo + copy: + src: logo.png + dest: "{{ emacsconf_home }}/logo.png" +# - name: Start jack +# shell: jackd -r -ddummy +# async: 2592000 +- name: Set up pulse + include: pulse.yml + tags: pulse +- name: Set up Firefox + tags: firefox + include: firefox.yml +- name: Set up I3 directory + tags: wip + file: + path: "{{ emacsconf_home }}/.config/i3" + state: directory + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Set up I3 + tags: wip + template: + src: i3-config + dest: "{{ emacsconf_home }}/.config/i3/config" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" diff --git a/roles/obs/tasks/mpv.yml b/roles/obs/tasks/mpv.yml new file mode 100644 index 0000000..581472a --- /dev/null +++ b/roles/obs/tasks/mpv.yml @@ -0,0 +1,38 @@ +- name: add apt-key + apt_key: + url: https://non-gnu.uvt.nl/debian/uvt_key.gpg + state: present +- name: Add repo + apt_repository: + repo: deb https://non-gnu.uvt.nl/debian {{ ansible_distribution_release }} uvt +- name: Install mpv + apt: + name: mpv=0.34.1+fruit.2 +- name: Create MPV profile directory + file: + path: "{{ emacsconf_home }}/.config/mpv" + state: directory + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Add MPV profile + template: + src: mpv.conf + dest: "{{ emacsconf_home }}/.config/mpv/mpv.conf" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Download MPVC + git: + repo: https://github.com/lwilletts/mpvc.git + dest: /usr/src/mpvc +- name: Install MPVC + make: + chdir: /usr/src/mpvc + target: install +- name: Create mpv scripts for tracks + template: + src: mpv-track + dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-mpv" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: 0775 + loop: "{{ emacsconf_tracks }}" diff --git a/roles/obs/tasks/obs-from-source.yml b/roles/obs/tasks/obs-from-source.yml new file mode 100644 index 0000000..915aeb2 --- /dev/null +++ b/roles/obs/tasks/obs-from-source.yml @@ -0,0 +1,81 @@ +- name: Install packages + package: + name: + - xrdp + - xfce4 + - firefox-esr + - mpv + - ffmpeg + - cmake + - ninja-build + - pkg-config + - clang + - clang-format + - build-essential + - curl + - ccache + - libavcodec-dev + - libavdevice-dev + - libavfilter-dev + - libavformat-dev + - libavutil-dev + - libswresample-dev + - libswscale-dev + - libx264-dev + - libcurl4-openssl-dev + - libmbedtls-dev + - libgl1-mesa-dev + - libjansson-dev + - libluajit-5.1-dev + - python3-dev + - libx11-dev + - libxcb-randr0-dev + - libxcb-shm0-dev + - libxcb-xinerama0-dev + - libxcb-composite0-dev + - libxinerama-dev + - libxcb1-dev + - libx11-xcb-dev + - libxcb-xfixes0-dev + - swig + - libcmocka-dev + - libpci-dev + - libxss-dev + - libglvnd-dev + - libgles2-mesa + - libgles2-mesa-dev + - libwayland-dev + - libxkbcommon-dev + - qtbase5-dev + - qtbase5-private-dev + - libqt5svg5-dev + - qtwayland5 + - libasound2-dev + - libfontconfig-dev + - libfreetype6-dev + - libjack-jackd2-dev + - libpulse-dev + - libsndio-dev + - libspeexdsp-dev + - libudev-dev + - libv4l-dev + - libva-dev + - libvlc-dev + - libdrm-dev +- name: Install source + git: + repo: https://github.com/obsproject/obs-studio.git + dest: /usr/src/obs + recursive: true +- name: Configure + shell: sudo cmake -S . -B build -G Ninja -DENABLE_PIPEWIRE=OFF -DENABLE_AJA=0 -DENABLE_BROWSER=OFF -DENABLE_NEW_MPEGTS_OUTPUT=OFF + args: + chdir: /usr/src/obs +- name: Build + shell: sudo cmake --build build + args: + chdir: /usr/src/obs +- name: Install + shell: sudo cmake --install build + args: + chdir: /usr/src/obs diff --git a/roles/obs/tasks/obs-setup.yml b/roles/obs/tasks/obs-setup.yml new file mode 100644 index 0000000..be82a8f --- /dev/null +++ b/roles/obs/tasks/obs-setup.yml @@ -0,0 +1,37 @@ +- name: Create OBS scene directory + file: + path: "{{ emacsconf_home }}/.config/obs-studio/basic/scenes" + state: directory + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Create profile directories + file: + path: "{{ obs_profile_path }}/{{ item.name }}" + state: directory + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: 0775 + loop: "{{ emacsconf_tracks }}" +- name: Install OBS profiles + template: + src: profile.ini + dest: "{{ obs_profile_path }}/{{ item.name }}/basic.ini" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + force: no + mode: 0664 + loop: "{{ emacsconf_tracks }}" +- name: Install OBS scenes + template: + src: scenes.json + dest: "{{ emacsconf_home }}/.config/obs-studio/basic/scenes/{{ item.id }}.json" + force: no + loop: "{{ emacsconf_tracks }}" +- name: Create OBS scripts for tracks + template: + src: obs-track + dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-obs" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: 0775 + loop: "{{ emacsconf_tracks }}" diff --git a/roles/obs/tasks/pulse.yml b/roles/obs/tasks/pulse.yml new file mode 100644 index 0000000..1cb71c5 --- /dev/null +++ b/roles/obs/tasks/pulse.yml @@ -0,0 +1,23 @@ +- name: Create pulse directory + file: + state: directory + path: "{{ emacsconf_home }}/.config/pulse/" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Set up pulse configuration + template: + src: pulse + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + dest: "{{ emacsconf_home }}/.config/pulse/default.pa" + mode: 0755 +- name: Change ownership + file: + state: directory + path: "{{ emacsconf_home }}/.config/pulse/" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + recurse: true +# - name: Start pulseaudio +# become_user: "{{ emacsconf_user }}" +# shell: pulseaudio --start diff --git a/roles/obs/tasks/tigervnc.yml b/roles/obs/tasks/tigervnc.yml new file mode 100644 index 0000000..539b70e --- /dev/null +++ b/roles/obs/tasks/tigervnc.yml @@ -0,0 +1,54 @@ +- name: Add packages + apt: + name: + - tigervnc-standalone-server + - tigervnc-common +- name: Create VNC dirs + file: + path: /home/{{ emacsconf_user }}/.vnc + state: directory + mode: 0755 + owner: "{{ emacsconf_user }}" +# https://github.com/sdarwin/Ansible-VNC/blob/master/tasks/main.yml +- name: Set VNC password + become: "{{ emacsconf_user }}" + shell: | + set -o pipefail + printf "{{ vnc_password }}\n{{ vnc_password }}\n\n" | vncpasswd /home/{{ emacsconf_user }}/.vnc/passwd + args: + chdir: "/home/{{ emacsconf_user }}/.vnc" + creates: "/home/{{ emacsconf_user }}/.vnc/passwd" + executable: /bin/bash +- name: Set up xstartup + template: + src: xstartup + dest: ~{{ emacsconf_user }}/.vnc/xstartup + mode: 0700 +- name: Set up xstartup for the tracks + template: + src: xstartup-track + dest: ~{{ emacsconf_user }}/.vnc/xstartup-{{ item.id }} + mode: 0700 + loop: "{{ emacsconf_tracks }}" +- name: Set up xstartup + template: + src: xresources + dest: ~{{ emacsconf_user }}/.Xresources + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: 0600 +- name: Set up VNC scripts + template: + src: vnc-track + dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-vnc" + mode: 0755 + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + loop: "{{ emacsconf_tracks }}" +- name: Set permissions and ownership + file: + path: "/home/{{ emacsconf_user }}/.vnc" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + mode: "u+rwX,g-rwx,o-rwx" + recurse: t diff --git a/roles/obs/tasks/user.yml b/roles/obs/tasks/user.yml new file mode 100644 index 0000000..c1493dd --- /dev/null +++ b/roles/obs/tasks/user.yml @@ -0,0 +1,25 @@ +- name: Add group + group: + name: "{{ emacsconf_group }}" +- name: Add user + user: + name: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +# password: "{{ emacsconf_unix_password }}" +- name: Create SSH folder + file: + path: "/home/{{ emacsconf_user }}/.ssh" + owner: "{{ emacsconf_user }}" + state: directory + mode: 700 +- name: Set up SSH key access + template: + src: authorized_keys + dest: "/home/{{ emacsconf_user }}/.ssh/authorized_keys" + force: no +- name: Change ownership of SSH directory + file: + path: "/home/{{ emacsconf_user }}/.ssh" + recurse: true + owner: "{{ emacsconf_user }}" + mode: "u+rwX,g-rwx,o-rwx" diff --git a/roles/obs/tasks/xorg.conf b/roles/obs/tasks/xorg.conf new file mode 100644 index 0000000..1975093 --- /dev/null +++ b/roles/obs/tasks/xorg.conf @@ -0,0 +1,33 @@ +# This xorg configuration file is meant to be used +# to start a dummy X11 server. +# For details, please see: +# https://www.xpra.org/xorg.conf + +# Here we setup a Virtual Display of 1920x1080 pixels + +Section "Device" + Identifier "Configured Video Device" + Driver "dummy" + #VideoRam 4096000 + VideoRam 256000 + #VideoRam 16384 +EndSection + +Section "Monitor" + Identifier "Configured Monitor" + HorizSync 5.0 - 1000.0 + VertRefresh 5.0 - 200.0 + Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync +EndSection + +Section "Screen" + Identifier "Default Screen" + Monitor "Configured Monitor" + Device "Configured Video Device" + DefaultDepth 24 + SubSection "Display" + Viewport 0 0 + Depth 24 + Virtual 1280 720 + EndSubSection +EndSection
\ No newline at end of file |