summaryrefslogtreecommitdiffstats
path: root/roles/obs/tasks
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-31 21:53:15 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-31 21:53:15 -0400
commit4696aa1fed214fe1084d7c3deecaaa289bc0a1fd (patch)
treefa0d7d2d121cfe2787b1f1a94b2328aeff73c724 /roles/obs/tasks
parentb8c97d14ed81871eef51ba7253982c45258ec538 (diff)
downloademacsconf-ansible-4696aa1fed214fe1084d7c3deecaaa289bc0a1fd.tar.xz
emacsconf-ansible-4696aa1fed214fe1084d7c3deecaaa289bc0a1fd.zip
Update OBS, renamepublish and edit
Diffstat (limited to '')
-rw-r--r--roles/obs/tasks/firefox.yml36
-rw-r--r--roles/obs/tasks/main.yml76
-rw-r--r--roles/obs/tasks/mpv.yml21
-rw-r--r--roles/obs/tasks/obs-setup.yml40
-rw-r--r--roles/obs/tasks/pulse.yml6
-rw-r--r--roles/obs/tasks/tigervnc.yml39
-rw-r--r--roles/obs/tasks/track.yml83
-rw-r--r--roles/obs/tasks/user.yml14
8 files changed, 167 insertions, 148 deletions
diff --git a/roles/obs/tasks/firefox.yml b/roles/obs/tasks/firefox.yml
deleted file mode 100644
index d96e330..0000000
--- a/roles/obs/tasks/firefox.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-- 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
index cb981b1..36e14c3 100644
--- a/roles/obs/tasks/main.yml
+++ b/roles/obs/tasks/main.yml
@@ -19,61 +19,39 @@
- dbus-x11
- obs-studio
- xserver-xorg-dev
+ - xdotool
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: Add Firefox
+ apt:
+ name: firefox-esr
+ when: ansible_distribution == "Debian"
+- name: Add Firefox
+ apt:
+ name: firefox-esr
+ when: ansible_distribution == "Ubuntu"
- 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 }}"
+- name: Set up track-specific things
+ include: track.yml
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 }}"
+- debug:
+ var: emacsconf_home
+- name: Add packages
+ apt:
+ name:
+ - tigervnc-standalone-server
+ - tigervnc-common
+ tags: vnc
+- name: Allow SSH for the users
+ replace:
+ dest: /etc/ssh/sshd_config.d/emacsconf_ssh.conf
+ regexp: '(AllowUsers(?!.*\b{{ emacsconf_id }}-{{ item.id }}\b).*)$'
+ replace: \1 {{ emacsconf_id }}-{{ item.id }}
+ loop: "{{ emacsconf_tracks }}"
+
+
diff --git a/roles/obs/tasks/mpv.yml b/roles/obs/tasks/mpv.yml
index 581472a..9fbdc05 100644
--- a/roles/obs/tasks/mpv.yml
+++ b/roles/obs/tasks/mpv.yml
@@ -8,18 +8,6 @@
- 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
@@ -28,11 +16,4 @@
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-setup.yml b/roles/obs/tasks/obs-setup.yml
index be82a8f..1da678a 100644
--- a/roles/obs/tasks/obs-setup.yml
+++ b/roles/obs/tasks/obs-setup.yml
@@ -1,37 +1,53 @@
- name: Create OBS scene directory
file:
- path: "{{ emacsconf_home }}/.config/obs-studio/basic/scenes"
- state: directory
+ path: "~{{ emacsconf_user }}/.config/obs-studio/basic/scenes"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
+ state: directory
- name: Create profile directories
file:
- path: "{{ obs_profile_path }}/{{ item.name }}"
+ path: "~{{ emacsconf_user }}/.config/obs-studio/basic/{{ item.name }}"
state: directory
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
mode: 0775
- loop: "{{ emacsconf_tracks }}"
+- name: Install OBS global profile
+ tags: wip
+ template:
+ src: global.ini
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ dest: "~{{ emacsconf_user }}/.config/obs-studio/global.ini"
- name: Install OBS profiles
template:
src: profile.ini
- dest: "{{ obs_profile_path }}/{{ item.name }}/basic.ini"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
- force: no
+ dest: "~{{ emacsconf_user }}/.config/obs-studio/basic/{{ item.name }}/basic.ini"
mode: 0664
- loop: "{{ emacsconf_tracks }}"
- name: Install OBS scenes
+ tags: obs-scene
template:
src: scenes.json
- dest: "{{ emacsconf_home }}/.config/obs-studio/basic/scenes/{{ item.id }}.json"
- force: no
- loop: "{{ emacsconf_tracks }}"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ dest: "~{{ emacsconf_user }}/.config/obs-studio/basic/scenes/{{ item.id }}.json"
+- name: Create text files for OBS sources
+ copy:
+ content: "Initializing..."
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ dest: "~{{ emacsconf_user }}/{{ item }}.txt"
+ mode: 0664
+ loop:
+ - news
+ - url
+ - bottom
- name: Create OBS scripts for tracks
template:
src: obs-track
- dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-obs"
+ dest: "~{{ emacsconf_user }}/bin/track-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
index 1cb71c5..f9a18f7 100644
--- a/roles/obs/tasks/pulse.yml
+++ b/roles/obs/tasks/pulse.yml
@@ -1,7 +1,7 @@
- name: Create pulse directory
file:
state: directory
- path: "{{ emacsconf_home }}/.config/pulse/"
+ path: "~{{ emacsconf_user }}/.config/pulse/"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
- name: Set up pulse configuration
@@ -9,12 +9,12 @@
src: pulse
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
- dest: "{{ emacsconf_home }}/.config/pulse/default.pa"
+ dest: "~{{ emacsconf_user }}/.config/pulse/default.pa"
mode: 0755
- name: Change ownership
file:
state: directory
- path: "{{ emacsconf_home }}/.config/pulse/"
+ path: "~{{ emacsconf_user }}/.config/pulse/"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
recurse: true
diff --git a/roles/obs/tasks/tigervnc.yml b/roles/obs/tasks/tigervnc.yml
index 539b70e..e895bec 100644
--- a/roles/obs/tasks/tigervnc.yml
+++ b/roles/obs/tasks/tigervnc.yml
@@ -1,36 +1,27 @@
-- name: Add packages
- apt:
- name:
- - tigervnc-standalone-server
- - tigervnc-common
- name: Create VNC dirs
file:
- path: /home/{{ emacsconf_user }}/.vnc
+ path: ~{{ emacsconf_user }}/.vnc
state: directory
- mode: 0755
owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ mode: 0755
# 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
+ printf "{{ vnc_password }}\n{{ vnc_password }}\n\n" | vncpasswd ~{{ emacsconf_user }}/.vnc/passwd
args:
- chdir: "/home/{{ emacsconf_user }}/.vnc"
- creates: "/home/{{ emacsconf_user }}/.vnc/passwd"
+ chdir: "~{{ emacsconf_user }}/.vnc"
+ creates: "~{{ 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 }}
+ dest: ~{{ emacsconf_user }}/.vnc/xstartup
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
mode: 0700
- loop: "{{ emacsconf_tracks }}"
-- name: Set up xstartup
+- name: Set up xresources
template:
src: xresources
dest: ~{{ emacsconf_user }}/.Xresources
@@ -40,15 +31,7 @@
- name: Set up VNC scripts
template:
src: vnc-track
- dest: "{{ emacsconf_home }}/bin/{{ item.id }}/-vnc"
+ dest: "~{{ emacsconf_user }}/bin/track-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/track.yml b/roles/obs/tasks/track.yml
new file mode 100644
index 0000000..93b789d
--- /dev/null
+++ b/roles/obs/tasks/track.yml
@@ -0,0 +1,83 @@
+- name: Set vars
+ tags: wip, obs-scene, mpv
+ set_fact:
+ old_emacsconf_user: "{{ emacsconf_user }}"
+ old_emacsconf_home: "{{ emacsconf_home }}"
+ emacsconf_user: "{{ emacsconf_id }}-{{ item.id }}"
+ emacsconf_home: "/home/{{ emacsconf_id }}-{{ item.id }}"
+- debug:
+ var: emacsconf_home
+- name: Set up user
+ include: user.yml
+- name: Set up user-related things
+ become: "{{ emacsconf_user }}"
+ block:
+ - name: Set up track bins for addition to paths
+ file:
+ path: "~{{ emacsconf_user }}/bin/{{ item.id }}"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ state: directory
+ - name: Set up VNC
+ include: tigervnc.yml
+ - name: Create MPV profile directory
+ file:
+ path: "~{{ emacsconf_user }}/.config/mpv"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ state: directory
+ - name: Add MPV profile
+ template:
+ src: mpv.conf
+ dest: "~{{ emacsconf_user }}/.config/mpv/mpv.conf"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ - name: Create mpv scripts for tracks
+ template:
+ src: mpv-track
+ dest: "~{{ emacsconf_user }}/bin/track-mpv"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ mode: 0775
+ - 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: "~{{ emacsconf_user }}/bin/stream-desktop-with-ffmpeg"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ mode: 0775
+ loop: "{{ emacsconf_tracks }}"
+ - name: Copy logo
+ copy:
+ src: logo.png
+ dest: "~{{ emacsconf_user }}/logo.png"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ # - name: Start jack
+ # shell: jackd -r -ddummy
+ # async: 2592000
+ - name: Set up pulse
+ include: pulse.yml
+ tags: pulse
+ - name: Set up I3 directory
+ file:
+ path: "~{{ emacsconf_user }}/.config/i3"
+ state: directory
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ - name: Set up I3
+ template:
+ src: i3-config
+ dest: "~{{ emacsconf_user }}/.config/i3/config"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+- name: Reset vars
+ tags: wip, obs-scene, mpv
+ set_fact:
+ old_emacsconf_user: "{{ emacsconf_user }}"
+ old_emacsconf_home: "{{ emacsconf_home }}"
+ emacsconf_user: "{{ old_emacsconf_user }}"
+ emacsconf_home: "{{ old_emacsconf_home }}"
diff --git a/roles/obs/tasks/user.yml b/roles/obs/tasks/user.yml
index c1493dd..a941d7f 100644
--- a/roles/obs/tasks/user.yml
+++ b/roles/obs/tasks/user.yml
@@ -2,9 +2,11 @@
group:
name: "{{ emacsconf_group }}"
- name: Add user
+ tags: wip
user:
name: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
+ shell: /bin/bash
# password: "{{ emacsconf_unix_password }}"
- name: Create SSH folder
file:
@@ -23,3 +25,15 @@
recurse: true
owner: "{{ emacsconf_user }}"
mode: "u+rwX,g-rwx,o-rwx"
+- name: Create bin dir
+ file:
+ path: "/home/{{ emacsconf_user }}/bin"
+ state: directory
+ owner: "{{ emacsconf_user }}"
+- name: Set up bashrc
+ template:
+ src: bashrc
+ dest: "/home/{{ emacsconf_user }}/.bashrc"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+