Merge pull request #716 from darshitpp/ansible-nas-ispyagentdvr

Support iSpy AgentDVR
This commit is contained in:
David Stephens 2024-10-09 21:36:21 +01:00 committed by GitHub
commit 81780859ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 153 additions and 0 deletions

View file

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

View file

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

View file

@ -193,6 +193,10 @@
tags: tags:
- homepage - homepage
- role: ispyagentdvr
tags:
- ispyagentdvr
- role: jackett - role: jackett
tags: tags:
- jackett - 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,54 @@
---
- 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: Create 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"
homepage.group: Monitoring
homepage.name: iSpy AgentDVR
homepage.icon: ispy.png
homepage.href: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ ispyagentdvr_webui_port }}"
homepage.description: Camera Monitoring software
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