charliemaiors.shinobi
Shinobi
Shinobiロールは、Ubuntu、CentOS、またはArchlinuxシステムにShinobi CCTVシステムをデプロイします。変数を使用することで、CE版またはPro版をデプロイすることが可能です。
要件
このロールの要件は、NodejsとnpmとFFMPEGです。また、shinobiデータベースとスキーマがすでに作成された状態で、MariaDB/Postgresのインスタンスが稼働している必要があります。これをshinobi-dbロールを使用してデプロイすることも可能です。
ロール変数
このロールには主に3つの変数が必要です(子ノードの場合は別です。クラスタリングを参照):
db_host: "localhost"
shinobi_pass: "test"
shinobi_port: "8080"
db_host
変数はshinobiデータベースのアドレスで、ロールはすでに作成されて設定されていることを前提としています。アドレスが間違っている場合、ロールは失敗しませんが、Shinobiは動作しません。
shinobi_pass
変数は、データベースに接続するためのshinobiバックエンドサービスのパスワードです。
shinobi_port
変数はポートです。
デフォルトの変数は次のとおりです:
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
変数はランダムなパスワード生成に使用されます。ce/pro_version
はコミュニティおよびプロ版のためのShinobiコードリポジトリへの参照です。ce/pro
フラグは、ダウンロードするバージョンを定義します。lts
フラグは、ノードのバージョンをインストールするために使用され、sqliteの依存関係をインストールしないようにします(Node.js v8ではnpmからのsqliteインストールが失敗します)。
shinobi_user
はデフォルトのshinobiユーザー名で、dbhash
はパスワード保管に使用されるハッシュアルゴリズムです(依存関係セクションを参照)。shinobi_version
は、shinobiリポジトリからクローンするコミットハッシュまたはブランチです。
クラスタリング
子ノードの導入に伴い、定義できる2つの追加変数があります。
cluster: true or false
cluster_role: "child" or "master"
cluster_role
が子に設定されている場合、master_key
とmaster_ip
も提供する必要があります。
依存関係
このロールはnodejsおよびffmpegロールに直接依存しています。また、Mysql/Mariadbおよびshinobiスキーマ定義に間接的に依存しています。直接の依存関係リストは以下の通りです:
- charliemaiors.nodejs(ltsフラグはnodejsロールにも適用され、どのバージョンをインストールするかを決定します)
- charliemaiors.ffmpeg
間接的な依存関係はcharliemaiors.shinobi-dbにあり、共通変数としてshinobi_user
、shinobi_pass
が使われます。また、db_host
変数はデータベースホストマシンのアドレスを使用して決定することが可能です(同じマシンの場合はlocalhost
でもかまいません)。
例プレイブック
これはオールインワンインストールの例です:
- name: シノビを単一ホストにデプロイ
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
これは異なるマシンにデータベースを配置した例です:
-- name: シノビデータベースをデプロイ
hosts: shinobi-db
roles:
- { role: charliemaiors.shinobi-db, shinobi_pass: "shinobi-test-machine", user_pass: "shinobi-test", user_mail: "[email protected]"}
- name: シノビフロントエンドをデプロイ
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 }
これは異なるマシンにデータベースを配置し、子ノードも持つ例です:
- name: シノビデータベースをデプロイ
hosts: shinobi-db
roles:
- { role: charliemaiors.shinobi-db, shinobi_pass: "shinobi-test-machine", user_pass: "shinobi-test", user_mail: "[email protected]"}
- name: シノビマスターをデプロイ
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: シノビ子ノードをデプロイ
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" }
ライセンス
GNU GPL
著者情報
このロールは、2018年にCarlo Maioranoによって、Dipartimento di Informatica - Scienza e Ingegneria of Alma Mater Studiorumの開発者として作成されました。監督はグループリーダーのPaolo Bellavistaによって行われました。
ansible-galaxy install charliemaiors.shinobi