Support iSpy AgentDVR

This commit is contained in:
Darshit Patel 2024-06-10 23:59:01 +05:30
parent 1212b11125
commit 05dab3e6e1
10 changed files with 148 additions and 0 deletions

View file

@ -51,6 +51,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Heimdall](https://heimdall.site/) - Home server dashboard
* [Home Assistant](https://www.home-assistant.io) - Open source home automation
* [Homebridge](https://github.com/nfarina/homebridge) - Emulate the iOS HomeKit API
* [iSpy Agent DVR](https://www.ispyconnect.com/) - iSpy - Agent DVR is a video surveillance software
* [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers
* [Jellyfin](https://jellyfin.github.io) - The Free Software Media System
* [Joomla](https://www.joomla.org/) - Open source content management system

View file

@ -183,6 +183,14 @@ samba_shares:
browseable: yes
path: "{{ code_root }}"
- name: recordings
comment: "Recordings"
guest_ok: yes
public: yes
writable: yes
browseable: yes
path: "{{ recordings_root }}"
###
### NFS
###

View file

@ -189,6 +189,10 @@
tags:
- homepage
- role: ispyagentdvr
tags:
- ispyagentdvr
- role: jackett
tags:
- jackett

View file

@ -0,0 +1,23 @@
---
ispyagentdvr_enabled: false
ispyagentdvr_available_externally: false
# directories
ispyagentdvr_config_directory: "{{ docker_home }}/ispyagentdvr/config"
ispyagentdvr_commands_directory: "{{ docker_home }}/ispyagentdvr/commands"
ispyagentdvr_recordings_directory: "{{ downloads_root }}/recordings"
# uid / gid
ispyagentdvr_user_id: "1000"
ispyagentdvr_group_id: "1000"
# network
ispyagentdvr_webui_port: "8097"
ispyagentdvr_turn_port: "3478"
ispyagentdvr_agentdvr_host_port: "50000-50010"
# specs
ispyagentdvr_memory: 1g
# docker
ispyagentdvr_container_name: ispyagentdvr

View file

@ -0,0 +1,11 @@
# iSpyAgentDVR
Homepage: <https://www.ispyconnect.com/>
iSpy - Agent DVR is a video surveillance software.
## Usage
Set `ispyagentdvr_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
The iSpyAgentDVR UI can be accessed from <http://ansible_nas_host_or_ip:8097>.

View file

@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
ispyagentdvr_enabled: true

View file

@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
ispyagentdvr_enabled: false

View file

@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml
- name: Get container state
community.docker.docker_container_info:
name: "{{ ispyagentdvr_container_name }}"
register: result
- name: Check iSpyAgentDVR is running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false

View file

@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove iSpyAgentDVR
community.docker.docker_container:
name: "{{ ispyagentdvr_container_name }}"
state: absent
register: result
- name: Check iSpyAgentDVR is stopped
ansible.builtin.assert:
that:
- not result.changed

View file

@ -0,0 +1,49 @@
---
- name: Start iSpyAgentDVR
block:
- name: Create iSpyAgentDVR Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
# mode: 0755
with_items:
- "{{ ispyagentdvr_config_directory }}"
- "{{ ispyagentdvr_commands_directory }}"
- "{{ ispyagentdvr_recordings_directory }}"
- name: iSpyAgentDVR Docker Container
community.docker.docker_container:
name: "{{ ispyagentdvr_container_name }}"
image: mekayelanik/ispyagentdvr:latest
pull: true
volumes:
- "{{ ispyagentdvr_config_directory }}:/AgentDVR/Media/XML:rw"
- "{{ ispyagentdvr_commands_directory }}:/AgentDVR/Commands:rw"
- "{{ ispyagentdvr_recordings_directory }}:/AgentDVR/Media/WebServerRoot/Media:rw"
ports:
- "{{ ispyagentdvr_webui_port }}:8090"
- "{{ ispyagentdvr_turn_port }}:3478/udp"
- "{{ ispyagentdvr_agentdvr_host_port }}:50000-50010/udp"
env:
TZ: "{{ ansible_nas_timezone }}"
WEBUI_PORT: "{{ ispyagentdvr_webui_port }}"
PUID: "{{ ispyagentdvr_user_id }}"
PGID: "{{ ispyagentdvr_group_id }}"
restart_policy: unless-stopped
memory: "{{ ispyagentdvr_memory }}"
labels:
traefik.enable: "{{ ispyagentdvr_available_externally | string }}"
traefik.http.routers.ispyagentdvr.rule: "Host(`ispyagentdvr.{{ ansible_nas_domain }}`)"
traefik.http.routers.ispyagentdvr.tls.certresolver: "letsencrypt"
traefik.http.routers.ispyagentdvr.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.ispyagentdvr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.ispyagentdvr.loadbalancer.server.port: "8097"
when: ispyagentdvr_enabled is true
- name: Stop iSpyAgentDVR
block:
- name: Stop iSpyAgentDVR
community.docker.docker_container:
name: "{{ ispyagentdvr_container_name }}"
state: absent
when: ispyagentdvr_enabled is false