Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Addition of motionEye #660

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ If you have a spare domain name you can configure applications to be accessible
* [MiniDLNA](https://sourceforge.net/projects/minidlna/) - simple media server which is fully compliant with DLNA/UPnP-AV clients
* [Miniflux](https://miniflux.app/) - An RSS news reader
* [Mosquitto](https://mosquitto.org) - An open source MQTT broker
* [motionEye](https://github.com/motioneye-project/motioneye) - A web-based frontend for motion, that monitors cameras for movement and performs actions
* [Mumble](https://www.mumble.info) - Open source, low latency, high quality voice chat
* [Mylar](https://github.com/evilhero/mylar) - An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents
* [MyMediaForAlexa](https://www.mymediaalexa.com/) - Lets you stream your music collection to your alexa device
Expand Down
16 changes: 16 additions & 0 deletions roles/motioneye/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
motioneye_enabled: false

# directories
motioneye_config_directory: "{{ docker_home }}/motioneye/config"
motioneye_media_directory: "{{ docker_home }}/motioneye/media"

# network
motioneye_port: "8765"
motioneye_streaming_port: "8081"

# video from host
motioneye_device: "/dev/video0"

# specs
motioneye_memory: "1g"
24 changes: 24 additions & 0 deletions roles/motioneye/docs/motioneye.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# motionEye

Homepage: <https://github.com/motioneye-project/motioneye>

motionEye is a web-based frontend for motion. It features

- web-based, mobile/tablet-friendly user interface
- compatible with most USB cameras as well as with the Raspberry PI camera module
- support for IP (network) cameras
- motion detection with email notifications and working schedule
- JPEG files for still images, AVI files for videos
- timelapse movies
- uploading media files to Google Drive and Dropbox

## Usage

Set `motioneye_enabled: true` in your `inventories/<your_inventory>/nas.yml` file. If you have a local video device (e.g., webcam) then this can be passed through using `motioneye_device=<v4l device path>'. By default it will passthrough /dev/video0 if present, this can be overriden using /dev/null.

The motionEye web interface can be found at <http://ansible_nas_host_or_ip:8765>

## Specific Configuration

Once started, use "admin" with empty password when prompted for credentials.

6 changes: 6 additions & 0 deletions roles/motioneye/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
motioneye_enabled: true
10 changes: 10 additions & 0 deletions roles/motioneye/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -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:
motioneye_enabled: false
20 changes: 20 additions & 0 deletions roles/motioneye/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# This is a playbook to execute Ansible tests.

- 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: "{{ motioneye_container_name }}"
register: result

- name: Check motionEye is running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
20 changes: 20 additions & 0 deletions roles/motioneye/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# This is a playbook to execute Ansible tests.

- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove motionEye
community.docker.docker_container:
name: "{{ motioneye_container_name }}"
state: absent
register: result

- name: Check motionEye is stopped
ansible.builtin.assert:
that:
- not result.changed
25 changes: 25 additions & 0 deletions roles/motioneye/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Create Motioneye Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ motioneye_config_directory }}"
- "{{ motioneye_media_directory }}"

- name: Motioneye Docker Container
community.docker.docker_container:
name: motioneye
image: ccrisan/motioneye:master-amd64
pull: true
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "{{ motioneye_config_directory }}:/etc/motioneye:rw"
- "{{ motioneye_media_directory }}:/var/lib/motioneye:rw"
ports:
- "{{ motioneye_port }}:8765"
- "{{ motioneye_streaming_port }}:8181"
devices:
- "{{ (motioneye_device != None) | ternary(motioneye_device, '/dev/null') }}"
restart_policy: unless-stopped
memory: "{{ motioneye_memory }}"