diff --git a/roles/fetlab/files/motion.conf b/roles/fetlab/files/motion.conf new file mode 100644 index 0000000..43d7236 --- /dev/null +++ b/roles/fetlab/files/motion.conf @@ -0,0 +1,14 @@ +# @enabled on +# @show_advanced on +# @normal_password da559fac89e576192f868ff898652ec74cb7b4d6 +# @admin_username admin +# @admin_password da559fac89e576192f868ff898652ec74cb7b4d6 +# @normal_username user + + +thread thread-1.conf +webcontrol_html_output on +webcontrol_port 7999 +setup_mode off +webcontrol_parms 2 +webcontrol_localhost on diff --git a/roles/fetlab/files/motioneye.conf b/roles/fetlab/files/motioneye.conf new file mode 100755 index 0000000..ff9cc1d --- /dev/null +++ b/roles/fetlab/files/motioneye.conf @@ -0,0 +1,97 @@ + +# path to the configuration directory (must be writable by motionEye) +conf_path /etc/motioneye + +# path to the directory where pid files go (must be writable by motionEye) +run_path /var/run/motioneye + +# path to the directory where log files go (must be writable by motionEye) +log_path /var/log/motioneye + +# default output path for media files (must be writable by motionEye) +media_path /var/lib/motioneye + +# the log level (use quiet, error, warning, info or debug) +log_level info + +# the IP address to listen on +# (0.0.0.0 for all interfaces, 127.0.0.1 for localhost) +listen 0.0.0.0 + +# the TCP port to listen on +port 8765 + +# path to the motion binary to use (automatically detected if commented) +#motion_binary /usr/bin/motion + +# whether motion HTTP control interface listens on +# localhost or on all interfaces +motion_control_localhost true + +# the TCP port that motion HTTP control interface listens on +motion_control_port 7999 + +# interval in seconds at which motionEye checks if motion is running +motion_check_interval 10 + +# whether to restart the motion daemon when an error occurs while communicating with it +motion_restart_on_errors false + +# interval in seconds at which motionEye checks the SMB mounts +mount_check_interval 300 + +# interval in seconds at which the janitor is called +# to remove old pictures and movies +cleanup_interval 43200 + +# timeout in seconds to wait for response from a remote motionEye server +remote_request_timeout 10 + +# timeout in seconds to wait for mjpg data from the motion daemon +mjpg_client_timeout 10 + +# timeout in seconds after which an idle mjpg client is removed +# (set to 0 to disable) +mjpg_client_idle_timeout 10 + +# enable SMB shares (requires motionEye to run as root) +smb_shares false + +# the directory where the SMB mount points will be created +smb_mount_root /media + +# path to the wpa_supplicant.conf file +# (enable this to configure wifi settings from the UI) +#wpa_supplicant_conf /etc/wpa_supplicant.conf + +# path to the localtime file +# (enable this to configure the system time zone from the UI) +#local_time_file /etc/localtime + +# enables shutdown and rebooting after changing system settings +# (such as wifi settings or time zone) +enable_reboot false + +# timeout in seconds to use when talking to the SMTP server +smtp_timeout 60 + +# timeout in seconds to wait for media files list +list_media_timeout 120 + +# timeout in seconds to wait for media files list, when sending emails +list_media_timeout_email 10 + +# timeout in seconds to wait for zip file creation +zip_timeout 500 + +# timeout in seconds to wait for timelapse creation +timelapse_timeout 500 + +# enable adding and removing cameras from UI +add_remove_cameras true + +# enables HTTP basic authentication scheme (in addition to, not instead of the signature mechanism) +http_basic_auth false + +# overrides the hostname (useful if motionEye runs behind a reverse proxy) +# server_name motionEye diff --git a/roles/fetlab/files/motioneye.service b/roles/fetlab/files/motioneye.service new file mode 100644 index 0000000..3aab77c --- /dev/null +++ b/roles/fetlab/files/motioneye.service @@ -0,0 +1,10 @@ +[Unit] +Description=motionEye Server + +[Service] +ExecStart=/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf +Restart=on-abort +User=motion + +[Install] +WantedBy=multi-user.target diff --git a/roles/fetlab/files/thread-1.conf b/roles/fetlab/files/thread-1.conf new file mode 100644 index 0000000..57c69c3 --- /dev/null +++ b/roles/fetlab/files/thread-1.conf @@ -0,0 +1,82 @@ +# @webcam_resolution 100 +# @upload_subfolders on +# @upload_server +# @enabled on +# @network_server +# @upload_username +# @motion_detection on +# @upload_port +# @upload_location +# @preserve_movies 0 +# @network_username +# @upload_movie on +# @id 1 +# @manual_record off +# @upload_password +# @upload_method post +# @upload_picture on +# @working_schedule_type outside +# @network_password +# @upload_service ftp +# @name Camera1 +# @preserve_pictures 0 +# @storage_device custom-path +# @manual_snapshots on +# @network_share_name +# @upload_enabled off +# @webcam_server_resize off +# @working_schedule + + +ffmpeg_output_movies on +height 576 +stream_quality 85 +threshold 12960 +quality 85 +noise_level 31 +ffmpeg_output_debug_movies off +pre_capture 1 +noise_tune on +smart_mask_speed 0 +stream_maxrate 5 +output_pictures on +hue 0 +saturation 0 +stream_localhost off +ffmpeg_variable_bitrate 75 +ffmpeg_video_codec mp4:h264_omx +text_changes off +movie_filename %Y-%m-%d/%H-%M-%S +auto_brightness off +stream_port 8081 +rotate 180 +brightness 0 +lightswitch 0 +framerate 2 +emulate_motion off +snapshot_filename %Y-%m-%d/%H-%M-%S +despeckle_filter +snapshot_interval 0 +stream_auth_method 0 +stream_motion off +target_dir /var/lib/motioneye/Camera1 +text_double on +post_capture 1 +stream_authentication user: +output_debug_pictures off +on_picture_save /usr/local/lib/python2.7/dist-packages/motioneye/scripts/relayevent.sh "/etc/motioneye/motioneye.conf" picture_save %t %f +on_movie_end /usr/local/lib/python2.7/dist-packages/motioneye/scripts/relayevent.sh "/etc/motioneye/motioneye.conf" movie_end %t %f +text_left Camera1 +picture_filename %Y-%m-%d/%H-%M-%S +locate_motion_style redbox +locate_motion_mode off +contrast 0 +videodevice /dev/v4l/by-id/usb-1b80_USB_2861_Device-video-index0 +max_movie_time 0 +on_event_end /usr/local/lib/python2.7/dist-packages/motioneye/scripts/relayevent.sh "/etc/motioneye/motioneye.conf" stop %t +text_right %Y-%m-%d\n%T +on_event_start /usr/local/lib/python2.7/dist-packages/motioneye/scripts/relayevent.sh "/etc/motioneye/motioneye.conf" start %t +event_gap 30 +minimum_motion_frames 20 +mask_file +width 720 diff --git a/roles/fetlab/handlers/main.yml b/roles/fetlab/handlers/main.yml new file mode 100644 index 0000000..29a4b79 --- /dev/null +++ b/roles/fetlab/handlers/main.yml @@ -0,0 +1,11 @@ +--- +- name: restart motion + service: name=motion state=restarted + +- name: restart motioneye systemd + systemd: daemon_reload=yes + listen: restart motioneye + +- name: restart motioneye service + service: name=motioneye state=restarted + listen: restart motioneye diff --git a/roles/fetlab/tasks/motion.yml b/roles/fetlab/tasks/motion.yml index 59a9223..7c26445 100644 --- a/roles/fetlab/tasks/motion.yml +++ b/roles/fetlab/tasks/motion.yml @@ -1,4 +1,49 @@ --- - - name: motion - install motion - package: name=motion +- name: motion - install motion + package: name=motion + +#- name: motion - /etc/default/motion +# replace: +# path: /etc/default/motion +# regexp: "^start_motion_daemon=.*" +# replace: "start_motion_daemon=yes" +# notify: restart motion + +- name: motion - install motioneye packages + package: "name={{ item }}" + with_items: + - python-pip + - python-dev + - python-setuptools + - curl + - libssl-dev + - libcurl4-openssl-dev + - libjpeg-dev + - libz-dev + - ffmpeg + - v4l-utils + +- name: motion - install motioneye + pip: name=motioneye state=latest executable=pip + notify: restart motioneye + +- name: motion - setup storage + file: "path={{ item }} owner=motion group=adm mode=755 state=directory" + with_items: + - /var/lib/motioneye/ + - /var/log/motioneye/ + - /var/run/motioneye/ + - /etc/motioneye/ + +- name: motion - configure motioneye + copy: "src={{ item }} dest=/etc/motioneye/{{ item }} owner=motion group=adm mode=0644" + with_items: + - motion.conf + - motioneye.conf + - thread-1.conf + notify: restart motioneye + +- name: motion - copy service file + copy: src=motioneye.service dest=/etc/systemd/system/motioneye.service + notify: restart motioneye