test candidate for full operation

This commit is contained in:
2025-08-24 21:57:15 -07:00
parent cc24088bbe
commit 0a5a7cc32c
9 changed files with 113 additions and 107 deletions

View File

@ -1,8 +1,5 @@
---
# - name: Video Capture - Configure Owncast
# include_tasks: owncast.yaml
- name: Video Capture - Check arch if needed
when: refresh_special | bool
block:
@ -15,25 +12,26 @@
set_fact:
cpu_architecture: "{{ cpu_architecture_output.stdout_lines[0] }}"
#- name: Video Capture - Install Packages
# when: not refresh_special | bool
# apt:
# name:
# - "{{ streamer_packages_items }}"
# state: present
# loop: "{{ streamer_packages }}"
# loop_control:
# loop_var: streamer_packages_items
#
#- name: Video Capture - SD Card Handler
# when: mount_sd | bool
# include_tasks: sd_handler.yaml
#
#- name: Video Capture - Configure MediaMTX
# include_tasks: mediamtx.yaml
#
#- name: Video Capture - Configure Streaming
# include_tasks: streamer.yaml
- name: Video Capture - Install Packages
when: not refresh_special | bool
apt:
name:
- "{{ streamer_packages_items }}"
state: present
loop: "{{ streamer_packages }}"
loop_control:
loop_var: streamer_packages_items
- name: Video Capture - SD Card Handler
when: mount_sd | bool
include_tasks: sd_handler.yaml
- name: Video Capture - Configure MediaMTX
when: not refresh_special | bool
include_tasks: mediamtx.yaml
- name: Video Capture - Configure Streaming
include_tasks: streamer.yaml
- name: Video Capture - Configure service control
include_tasks: service_control.yaml

View File

@ -1,10 +1,6 @@
---
# mediamtx might automatically make video files
# newest release URL:
# curl -sL https://api.github.com/repos/bluenviron/mediamtx/releases/latest | \
# grep browser_download_url | grep linux_amd64 | cut -d\" -f 4
# mediamtx automatically makes video files from rtmp streams
- name: MediaMTX - stop mediamtx_service if running
systemd:
@ -24,22 +20,21 @@
- name: MediaMTX - check for arm
when: '"arm" in cpu_architecture'
set_fact:
mediamtx_version: "arm64"
mediamtx_architecture: "arm64"
- name: MediaMTX - get current release URL
shell: |
curl -sL https://api.github.com/repos/bluenviron/mediamtx/releases/latest | \
grep browser_download_url | grep linux_{{ mediamtx_version }} | cut -d\" -f 4
grep browser_download_url | grep linux_{{ mediamtx_architecture }} | cut -d\" -f 4
register: mediamtx_latest_url
- debug:
msg: "URL To Download: {{ mediamtx_latest_url.stdout_lines[0] }}"
msg: "Current Release URL: {{ mediamtx_latest_url.stdout_lines[0] }}"
- name: MediaMTX - get current release archive
shell: "curl -s -o {{ mediamtx_working_folder }}/mediamtx.tar.gz -L {{ mediamtx_latest_url.stdout_lines[0] }}"
- name: MediaMTX - extract archive
unarchive:
# src: "/var/jenkins_home/ansible-files/programs/mediamtx_v1.14.0_linux_amd64.tar.gz"
src: "{{ mediamtx_working_folder }}/mediamtx.tar.gz"
dest: "{{ mediamtx_working_folder }}"
mode: '0755'
@ -53,25 +48,17 @@
loop: "{{ mediamtx_configs }}"
loop_control:
loop_var: mediamtx_configs_item
# - name: MediaMTX - config - enable recording
# lineinfile:
# path: "{{ mediamtx_working_folder }}/mediamtx.yml"
# search_string: 'record'
# line: ' record: yes'
#
- name: MediaMTX - create service file
template:
src: mediamtx_service.service.j2
dest: "/etc/systemd/system/mediamtx_service.service"
mode: 0644
# daemon reload
- name: MediaMTX - daemon reload
systemd:
daemon_reload: yes
# Enable and start
- name: MediaMTX - enable and start mediamtx_service
systemd:
name: mediamtx_service.service

View File

@ -1,7 +1,7 @@
---
# when ran, this will look for an SD card
# optionally format it
# optionally format it, be careful with that, it WILL destroy things
# map it to working_storage
# can only run on arm64
# '"arm64" in cpu_architecture'
@ -20,20 +20,13 @@
when: '"arm64" in cpu_architecture'
set_fact:
arm_arch: true
format_sd: false
- name: SD Handler - Checks have passed
when: sd_unmounted and arm_arch | bool
block:
- name: SD Handler - format SD card
when: format_sd | bool
block:
- name: dummy task
debug:
msg: "nothing to see here, move along"
- name: SD Handler - find SD card
- name: SD Handler - Get SD Device
block:
- name: SD Handler - get boot device
@ -44,6 +37,34 @@
shell: "lsblk -o NAME,SIZE --nodeps | grep -v -e loop -e {{ boot_device.stdout_lines[0] }} -e NAME | cut -d ' ' -f 1"
register: sd_card_device
- name: SD Handler - format SD card
when: format_sd | bool
block:
- name: SD Handler - clear existing partition table
shell: 'sgdisk --zap-all "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - create new partition table
shell: 'sgdisk --new=0:0:0 "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - create new volume table
shell: 'sgdisk --typecode=1:8300 --change-name=1:"Linux filesystem" "/dev/{{ sd_card_device.stdout_lines[0] }}"'
- name: SD Handler - find new volume
shell: 'blkid | grep {{ sd_card_device.stdout_lines[0] }} | cut -d: -f1'
register: new_sd_volume
- name: SD Handler - format new volume
shell: 'mkfs.ext4 {{ new_sd_volume.stdout_lines[0] }}'
register: format_output
- name: SD Handler - show format stdout
debug:
msg: "{{ format_output.stdout_lines }}"
- name: SD Handler - find SD card volume
block:
- name: SD Handler - get sd card uuid
shell: "blkid | grep {{ sd_card_device.stdout_lines[0] }} | awk '{for (i=1; i<=NF; i++) print $i}' | grep UUID | grep -v PART | cut -d '\"' -f 2"
register: sd_card_uuid_output
@ -98,5 +119,37 @@
- debug:
msg: "{{ sd_test_output.stdout_lines }}"
- name: SD Handler - Share with samba
block:
- name: SD Handler - Create config file
copy:
dest: "/etc/samba/smb.conf.d/vcr_rip.conf"
content: |
[vcr_rip]
path = {{ working_storage }}
writable = yes
read only = no
only guest = yes
public = yes
guest ok = yes
guest only = yes
guest account = nobody
browsable = yes
mode: 0644
- name: SD Handler - Include in smb.conf
lineinfile:
path: "/etc/smb.conf"
search_string: "/etc/smb/smb.conf.d/vcr_rip.conf"
line: "/etc/smb/smb.conf.d/vcr_rip.conf"
insertafter: 'map to guest'
- name: SD Handler - restart smbd
service:
name: smbd
state: restarted
enabled: yes
...

View File

@ -1,7 +1,8 @@
---
###############################################
# lifted directly from my carputer playbook
# lifted from my carputer playbook
# modified to work here
###############################################
###############################################
@ -122,17 +123,9 @@
owner: root
group: root
#- name: service_control_website - template index.php
# template:
# src: index-service_control.php.j2
# dest: "{{ service_control_web_folder }}/html/index.php"
# mode: 0644
###############################################
# Start service_control_website
###############################################
# https://unix.stackexchange.com/questions/265704/start-stop-a-systemd-service-at-specific-times
# i can create several conflicting services with various timeouts
- name: start service_control_website
when: not refresh_special | bool
@ -157,6 +150,4 @@
msg="{{ docker_output.stdout_lines }}"
msg="{{ docker_output.stderr_lines }}"
...

View File

@ -1,10 +1,9 @@
---
# video stream with ustreamer
# audio stream probably just a device
# looks like ffmpeg can do it
# Create service Folder
- name: video_capture - streamer - create streaming_working_folder folder
- name: "video_capture - streamer - create {{ streaming_working_folder }} folder"
file:
path: "{{ streaming_working_folder }}"
state: directory
@ -62,7 +61,6 @@
dest: /etc/systemd/system/stream_service.service
mode: 0644
# daemon reload
- name: video_capture - streamer - daemon reload
systemd:
daemon_reload: yes