|
| 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