Skip to content

Commit 8178085

Browse files
authored
Merge pull request #716 from darshitpp/ansible-nas-ispyagentdvr
Support iSpy AgentDVR
2 parents 24f4ab4 + 5ab867a commit 8178085

File tree

10 files changed

+153
-0
lines changed

10 files changed

+153
-0
lines changed

README.md

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

group_vars/all.yml

+8
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ samba_shares:
183183
browseable: yes
184184
path: "{{ code_root }}"
185185

186+
- name: recordings
187+
comment: "Recordings"
188+
guest_ok: yes
189+
public: yes
190+
writable: yes
191+
browseable: yes
192+
path: "{{ recordings_root }}"
193+
186194
###
187195
### NFS
188196
###

nas.yml

+4
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@
193193
tags:
194194
- homepage
195195

196+
- role: ispyagentdvr
197+
tags:
198+
- ispyagentdvr
199+
196200
- role: jackett
197201
tags:
198202
- jackett

roles/ispyagentdvr/defaults/main.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
ispyagentdvr_enabled: false
3+
ispyagentdvr_available_externally: false
4+
5+
# directories
6+
ispyagentdvr_config_directory: "{{ docker_home }}/ispyagentdvr/config"
7+
ispyagentdvr_commands_directory: "{{ docker_home }}/ispyagentdvr/commands"
8+
ispyagentdvr_recordings_directory: "{{ downloads_root }}/recordings"
9+
10+
# uid / gid
11+
ispyagentdvr_user_id: "1000"
12+
ispyagentdvr_group_id: "1000"
13+
14+
# network
15+
ispyagentdvr_webui_port: "8097"
16+
ispyagentdvr_turn_port: "3478"
17+
ispyagentdvr_agentdvr_host_port: "50000-50010"
18+
19+
# specs
20+
ispyagentdvr_memory: 1g
21+
22+
# docker
23+
ispyagentdvr_container_name: ispyagentdvr
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# iSpyAgentDVR
2+
3+
Homepage: <https://www.ispyconnect.com/>
4+
5+
iSpy - Agent DVR is a video surveillance software.
6+
7+
## Usage
8+
9+
Set `ispyagentdvr_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
10+
11+
The iSpyAgentDVR UI can be accessed from <http://ansible_nas_host_or_ip:8097>.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
provisioner:
3+
inventory:
4+
group_vars:
5+
all:
6+
ispyagentdvr_enabled: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Stop
3+
hosts: all
4+
become: true
5+
tasks:
6+
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
7+
ansible.builtin.include_role:
8+
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
9+
vars:
10+
ispyagentdvr_enabled: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- ansible.builtin.include_vars:
7+
file: ../../defaults/main.yml
8+
9+
- name: Get container state
10+
community.docker.docker_container_info:
11+
name: "{{ ispyagentdvr_container_name }}"
12+
register: result
13+
14+
- name: Check iSpyAgentDVR is running
15+
ansible.builtin.assert:
16+
that:
17+
- result.container['State']['Status'] == "running"
18+
- result.container['State']['Restarting'] == false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- ansible.builtin.include_vars:
7+
file: ../../defaults/main.yml
8+
9+
- name: Try and stop and remove iSpyAgentDVR
10+
community.docker.docker_container:
11+
name: "{{ ispyagentdvr_container_name }}"
12+
state: absent
13+
register: result
14+
15+
- name: Check iSpyAgentDVR is stopped
16+
ansible.builtin.assert:
17+
that:
18+
- not result.changed

roles/ispyagentdvr/tasks/main.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
- name: Start iSpyAgentDVR
3+
block:
4+
- name: Create iSpyAgentDVR Directories
5+
ansible.builtin.file:
6+
path: "{{ item }}"
7+
state: directory
8+
# mode: 0755
9+
with_items:
10+
- "{{ ispyagentdvr_config_directory }}"
11+
- "{{ ispyagentdvr_commands_directory }}"
12+
- "{{ ispyagentdvr_recordings_directory }}"
13+
14+
- name: Create iSpyAgentDVR Docker Container
15+
community.docker.docker_container:
16+
name: "{{ ispyagentdvr_container_name }}"
17+
image: mekayelanik/ispyagentdvr:latest
18+
pull: true
19+
volumes:
20+
- "{{ ispyagentdvr_config_directory }}:/AgentDVR/Media/XML:rw"
21+
- "{{ ispyagentdvr_commands_directory }}:/AgentDVR/Commands:rw"
22+
- "{{ ispyagentdvr_recordings_directory }}:/AgentDVR/Media/WebServerRoot/Media:rw"
23+
ports:
24+
- "{{ ispyagentdvr_webui_port }}:8090"
25+
- "{{ ispyagentdvr_turn_port }}:3478/udp"
26+
- "{{ ispyagentdvr_agentdvr_host_port }}:50000-50010/udp"
27+
env:
28+
TZ: "{{ ansible_nas_timezone }}"
29+
WEBUI_PORT: "{{ ispyagentdvr_webui_port }}"
30+
PUID: "{{ ispyagentdvr_user_id }}"
31+
PGID: "{{ ispyagentdvr_group_id }}"
32+
restart_policy: unless-stopped
33+
memory: "{{ ispyagentdvr_memory }}"
34+
labels:
35+
traefik.enable: "{{ ispyagentdvr_available_externally | string }}"
36+
traefik.http.routers.ispyagentdvr.rule: "Host(`ispyagentdvr.{{ ansible_nas_domain }}`)"
37+
traefik.http.routers.ispyagentdvr.tls.certresolver: "letsencrypt"
38+
traefik.http.routers.ispyagentdvr.tls.domains[0].main: "{{ ansible_nas_domain }}"
39+
traefik.http.routers.ispyagentdvr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
40+
traefik.http.services.ispyagentdvr.loadbalancer.server.port: "8097"
41+
homepage.group: Monitoring
42+
homepage.name: iSpy AgentDVR
43+
homepage.icon: ispy.png
44+
homepage.href: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ ispyagentdvr_webui_port }}"
45+
homepage.description: Camera Monitoring software
46+
when: ispyagentdvr_enabled is true
47+
48+
- name: Stop iSpyAgentDVR
49+
block:
50+
- name: Stop iSpyAgentDVR
51+
community.docker.docker_container:
52+
name: "{{ ispyagentdvr_container_name }}"
53+
state: absent
54+
when: ispyagentdvr_enabled is false

0 commit comments

Comments
 (0)