add apache index to sd handler

This commit is contained in:
2025-08-25 06:09:49 -07:00
parent 0df8d22959
commit f46e45b2b3
2 changed files with 76 additions and 4 deletions

View File

@ -119,6 +119,9 @@
- debug: - debug:
msg: "{{ sd_test_output.stdout_lines }}" msg: "{{ sd_test_output.stdout_lines }}"
- name: SD Handler - samba and index
block:
- name: SD Handler - Share with samba - name: SD Handler - Share with samba
block: block:
@ -140,10 +143,10 @@
- name: SD Handler - Include in smb.conf - name: SD Handler - Include in smb.conf
lineinfile: lineinfile:
path: "/etc/smb.conf" path: "/etc/samba/smb.conf"
search_string: "/etc/smb/smb.conf.d/vcr_rip.conf" search_string: "/etc/samba/smb.conf.d/vcr_rip.conf"
line: "/etc/smb/smb.conf.d/vcr_rip.conf" line: "include /etc/samba/smb.conf.d/vcr_rip.conf"
insertafter: 'map to guest' insertafter: '[global]'
- name: SD Handler - restart smbd - name: SD Handler - restart smbd
service: service:
@ -151,5 +154,62 @@
state: restarted state: restarted
enabled: yes enabled: yes
- name: SD Handler - Apache Index
block:
###############################################
# Clone and build apache-index
###############################################
- name: SD Handler - - apache-index - Ensure the destination directory exists
file:
path: /opt/cosmos/apache-index # Replace with your desired directory on the target machine
state: directory
mode: '0755'
- name: SD Handler - - apache-index - Clone the Git repository
git:
repo: 'https://gitea.matt-cloud.com/matt/apache-index.git' # Replace with your repository URL
dest: '/opt/cosmos/apache-index' # Replace with your desired directory on the target machine
version: 'main' # Replace with the branch, tag, or commit you want to clone
force: yes
- name: SD Handler - - apache-index - Build image
docker_image:
name: apache-index # Name of the SD Handler - image
source: build
build:
path: /opt/cosmos/apache-index # Path to the directory containing your Dockerfile
state: present
tag: latest
register: build_index_output
- name: SD Handler - - apache-index - Image changed
debug: msg="{{ build_index_output.changed }}"
- name: SD Handler - - apache-index - Image failed
debug: msg="{{ build_index_output.failed }}"
- name: SD Handler - - apache-index - Image layers
debug: msg="{{ build_index_output.image.RootFS.Layers }}"
###############################################
# Install local-index 00
###############################################
- name: SD Handler - - local-index - create folder
file:
path: "{{ streaming_working_folder }}/local-index"
state: directory
mode: '0755'
- name: SD Handler - - local-index - Copy config
template:
src: docker-compose-local-index.yaml.j2
dest: "{{ streaming_working_folder }}/local-index/docker-compose.yaml"
mode: 0644
- name: SD Handler - - local-index - Start container at 172.17.0.1:8080
shell: "docker-compose -f {{ streaming_working_folder }}/local-index/docker-compose.yaml up -d"
register: local_index_output
- debug: |
msg="{{ local_index_output.stdout_lines }}"
msg="{{ local_index_output.stderr_lines }}"
... ...

View File

@ -0,0 +1,12 @@
# docker-compose.yaml
version: '3'
services:
local-index:
image: apache-index
container_name: local-index
ports:
- 8080:80
volumes:
- {{ working_storage }}:/mnt/smb
network_mode: bridge
restart: always