charliemaiors.shinobi
Shinobi
The Shinobi role installs the Shinobi CCTV system on Ubuntu, CentOS, or Archlinux. You can choose to install either the Community Edition (CE) or the Pro version using variables.
Requirements
You need Nodejs with npm and FFMPEG for this role. Additionally, you must have a running instance of MariaDB/Postgres with the shinobi database and schemas already set up, which can also be done using the shinobi-db role.
Role Variables
There are three main variables needed (unless it’s a child node, in which case, see clustering):
db_host: "localhost"
shinobi_pass: "test"
shinobi_port: "8080"
db_host
: This is the address of the shinobi database. The role assumes it’s already created and set up. If the address is incorrect, the role won't fail, but Shinobi won't function.shinobi_pass
: This is the password for the Shinobi backend service to connect to the database.shinobi_port
: This is the port on which Shinobi will run.
Default variables include:
random_key: "{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}"
ce_version: "https://gitlab.com/Shinobi-Systems/ShinobiCE.git"
pro_version: "https://gitlab.com/Shinobi-Systems/Shinobi.git"
ce: true
pro: false
lts: true
startup: true
shinobi_user: "shinobi"
shinobi_version: "HEAD"
dbhash: "md5"
random_key
: Used for generating random passwords.ce_version
/pro_version
: Links to the community and pro versions of the Shinobi Code repository, respectively.ce
/pro
: Flags that determine which version to download.lts
: Indicates which version of Node.js is installed to avoid issues with SQLite dependencies.shinobi_user
: The default user for the Shinobi database.dbhash
: The hashing algorithm for storing passwords.shinobi_version
: Specifies which commit or branch to clone from the Shinobi repository.
Clustering
When using child nodes, you need two additional variables:
cluster: true or false
cluster_role: "child" or "master"
If cluster_role
is set to child, you also need to provide master_key
and master_ip
.
Dependencies
This role directly depends on the Node.js and FFMPEG roles and indirectly depends on MySQL/MariaDB with the defined shinobi schema. The list of direct dependencies is:
charliemaiors.nodejs
(the lts flag is also used here to determine which version to install)charliemaiors.ffmpeg
The indirect dependency is with charliemaiors.shinobi-db
, using common variables like shinobi_user
, shinobi_pass
, and the db_host
variable, which can be the database machine address or localhost
.
Example Playbook
Here’s an example for an all-in-one installation:
- name: Deploy Shinobi on Single host
hosts: shinobi-all-in-one
vars:
shinobi_pass: "shinobi-test-machine"
db_host: "localhost"
shinobi_port: "8080"
user_pass: "shinobi-test"
user_mail: "[email protected]"
dbhash: "sha256"
startup: true
ce: false
pro: true
lts: true
roles:
- charliemaiors.nodejs
- charliemaiors.ffmpeg
- charliemaiors.shinobi-db
- charliemaiors.shinobi
Example for a database on a different machine:
- name: Deploy shinobi db
hosts: shinobi-db
roles:
- { role: charliemaiors.shinobi-db, shinobi_pass: "shinobi-test-machine", user_pass: "shinobi-test", user_mail: "[email protected]"}
- name: Deploy shinobi frontend
hosts: shinobi-fe
roles:
- charliemaiors.nodejs
- charliemaiors.ffmpeg
- { role: charliemaiors.shinobi, db_host: "{{ hostvars[groups['shinobi-db'][0]].ansible_host }}", shinobi_port: "8080", user_pass: "shinobi-test", user_mail: "[email protected]", shinobi_pass: "shinobi-test-machine", startup: true, ce: false, pro: true }
Example with a database on a different machine and child nodes:
- name: Deploy shinobi db
hosts: shinobi-db
roles:
- { role: charliemaiors.shinobi-db, shinobi_pass: "shinobi-test-machine", user_pass: "shinobi-test", user_mail: "[email protected]"}
- name: Deploy shinobi master
hosts: shinobi-master
roles:
- charliemaiors.nodejs
- charliemaiors.ffmpeg
- { role: charliemaiors.shinobi, db_host: "{{ hostvars[groups['shinobi-db'][0]].ansible_host }}", shinobi_port: "8080", user_pass: "shinobi-test", user_mail: "[email protected]", shinobi_pass: "shinobi-test-machine", startup: true, ce: false, pro: true, cluster: true, cluster_role: "master", master_key: "test" }
- name: Deploy shinobi child nodes
hosts: shinobi-childs
roles:
- charliemaiors.nodejs
- charliemaiors.ffmpeg
- { role: charliemaiors.shinobi, master_ip: "{{ hostvars[groups['shinobi-master'][0]].ansible_host }}", cluster: true, cluster_role: "child", master_key: "test" }
License
GNU GPL
Author Information
This role was created in 2018 by Carlo Maiorano as a developer for the Department of Computer Science and Engineering of Alma Mater Studiorum, under the direction and supervision of Paolo Bellavista as Group Leader.
ansible-galaxy install charliemaiors.shinobi