UniFi コントローラー: リリース時にチェックし、アップグレードを実行
中級
これはDevOps, AI Summarization分野の自動化ワークフローで、11個のノードを含みます。主にIf, Ssh, Code, Telegram, HttpRequestなどのノードを使用。 SSHとTelegram通知を利用したUniFiコントローラー更新の自動化
前提条件
- •Telegram Bot Token
- •ターゲットAPIの認証情報が必要な場合あり
- •OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"name": "UniFi Controller: Check & Upgrade on New Release",
"tags": [
{
"name": "SSH"
}
],
"nodes": [
{
"id": "e3552972-d4cd-40fd-8436-39b41a0e4123",
"name": "スケジュールトリガー",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
432,
288
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 13,
"triggerAtMinute": 13
}
]
}
},
"typeVersion": 1.2
},
{
"id": "0aa8ec9d-4567-46e0-8271-8cc71c567ead",
"name": "HTTPリクエスト",
"type": "n8n-nodes-base.httpRequest",
"position": [
624,
288
],
"parameters": {
"url": "https://dl.ui.com/unifi/debian/dists/stable/InRelease",
"options": {},
"responseFormat": "string"
},
"typeVersion": 4.2
},
{
"id": "2d7e4f46-02ff-48a5-8e2d-3908fd6f04fa",
"name": "コード名+日付の抽出+時間比較",
"type": "n8n-nodes-base.code",
"position": [
864,
288
],
"parameters": {
"jsCode": "const inReleaseContent = $input.first().json.body || '';\n\n// Extract Codename\nconst codenameMatch = inReleaseContent.match(/^Codename:\\s*(.+)$/m);\nconst codename = codenameMatch ? codenameMatch[1].trim() : null;\n\n// Extract Date\nconst dateMatch = inReleaseContent.match(/^Date:\\s*(.+)$/m);\nconst dateString = dateMatch ? dateMatch[1].trim() : null;\n\nlet releaseTimestamp = null;\nlet changedInLast24h = false;\n\nif (dateString) {\n const parsedDate = new Date(dateString);\n if (!isNaN(parsedDate)) {\n releaseTimestamp = parsedDate.getTime();\n const now = Date.now();\n const diffHours = (now - releaseTimestamp) / (1000 * 60 * 60);\n changedInLast24h = diffHours <= 24;\n }\n}\n\nreturn [{ json: { codename, releaseDate: dateString, releaseTimestamp, changedInLast24h } }];"
},
"typeVersion": 2
},
{
"id": "d099755d-88bd-4ded-9206-3c84b0de25db",
"name": "条件分岐: 24時間以内に変更あり?",
"type": "n8n-nodes-base.if",
"position": [
1072,
288
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "35485051-ae36-4332-9e1d-4a73be0a044a",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.changedInLast24h }}"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "808ecc9c-50d2-442c-ad10-913f67e1b240",
"name": "パッケージリストの更新",
"type": "n8n-nodes-base.ssh",
"position": [
432,
512
],
"parameters": {
"cwd": "/root",
"command": "apt-get --allow-releaseinfo-change update",
"authentication": "privateKey"
},
"typeVersion": 1
},
{
"id": "b1f8686a-7c72-4283-baa4-3e43fe3e4ec9",
"name": "UniFiのアップグレード",
"type": "n8n-nodes-base.ssh",
"position": [
624,
512
],
"parameters": {
"cwd": "/root",
"command": "apt-get upgrade -y unifi",
"authentication": "privateKey"
},
"typeVersion": 1
},
{
"id": "1b892e4e-9f71-4537-abc1-4e135cac0f2c",
"name": "モデルへのメッセージ",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
464,
768
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "GPT-4.1-NANO"
},
"options": {},
"messages": {
"values": [
{
"content": "=Please concisely summarize the performed UniFi update and what's new in this release.\n\nCodename: {{ $('Extract Codename + Date + Time Comparison').item.json.codename }}\nRelease date: {{ $('Extract Codename + Date + Time Comparison').item.json.releaseDate }}\n\napt-get update exit code: {{ $('Update package lists').item.json.code }}\napt-get upgrade exit code/stdout: {{ $('Upgrade UniFi').item.json.code }} / {{ $('Upgrade UniFi').item.json.stdout }}"
}
]
}
},
"typeVersion": 1.8
},
{
"id": "8439a184-315b-4282-a8fd-3bce2025ee8e",
"name": "Telegram経由での通知",
"type": "n8n-nodes-base.telegram",
"position": [
800,
768
],
"parameters": {
"text": "=UniFi package updated:\n{{ $json.message && $json.message.content ? $json.message.content : 'Upgrade finished.' }}\n[Web interface](https://unifi.ui.com)",
"chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "1951d673-d0ed-4a1f-bd7d-dc1a24dd7d07",
"name": "付箋: トリガー&チェック",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
240
],
"parameters": {
"color": 5,
"width": 796,
"height": 220,
"content": "Trigger workflow and check if UniFi repo has updated within the last 24 hours"
},
"typeVersion": 1
},
{
"id": "c9e311b8-b821-40ef-b014-c0a0a7552507",
"name": "付箋: アップグレード",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
480
],
"parameters": {
"color": 4,
"width": 572,
"height": 220,
"content": "Issue package upgrade via SSH (controller host needs apt access and SSH key configured)"
},
"typeVersion": 1
},
{
"id": "691981f1-b61c-4b36-af6b-8ccdc92c57df",
"name": "付箋: 通知",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
736
],
"parameters": {
"width": 572,
"height": 220,
"content": "Inform via Telegram about the update (optional LLM for a short summary)\nRequire env var TELEGRAM_CHAT_ID and credentials binding."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"connections": {
"0aa8ec9d-4567-46e0-8271-8cc71c567ead": {
"main": [
[
{
"node": "2d7e4f46-02ff-48a5-8e2d-3908fd6f04fa",
"type": "main",
"index": 0
}
]
]
},
"b1f8686a-7c72-4283-baa4-3e43fe3e4ec9": {
"main": [
[
{
"node": "1b892e4e-9f71-4537-abc1-4e135cac0f2c",
"type": "main",
"index": 0
}
]
]
},
"1b892e4e-9f71-4537-abc1-4e135cac0f2c": {
"main": [
[
{
"node": "8439a184-315b-4282-a8fd-3bce2025ee8e",
"type": "main",
"index": 0
}
]
]
},
"e3552972-d4cd-40fd-8436-39b41a0e4123": {
"main": [
[
{
"node": "0aa8ec9d-4567-46e0-8271-8cc71c567ead",
"type": "main",
"index": 0
}
]
]
},
"808ecc9c-50d2-442c-ad10-913f67e1b240": {
"main": [
[
{
"node": "b1f8686a-7c72-4283-baa4-3e43fe3e4ec9",
"type": "main",
"index": 0
}
]
]
},
"d099755d-88bd-4ded-9206-3c84b0de25db": {
"main": [
[
{
"node": "808ecc9c-50d2-442c-ad10-913f67e1b240",
"type": "main",
"index": 0
}
],
[]
]
},
"2d7e4f46-02ff-48a5-8e2d-3908fd6f04fa": {
"main": [
[
{
"node": "d099755d-88bd-4ded-9206-3c84b0de25db",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - DevOps, AI要約
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
n8nの自動更新
バージョン確認とPortainer Webhookを使ってn8nのアップデートを自動化
If
Code
Http Request
+
If
Code
Http Request
12 ノードDominic Spatz
DevOps
Degen Alpha
OpenAIの暗号Alphaスキャナーを使用 - チェーンアドレスとソーシャルアラートをTelegramに送信
If
Code
Merge
+
If
Code
Merge
38 ノードLuka Zivkovic
仮想通貨取引
n8nの更新
Telegram approval システムを使った Docker コンテナ更新の自動化
If
Set
Ssh
+
If
Set
Ssh
27 ノードJaber Zare
DevOps
SOL/USDTマルチタイムフレームAI市場解析器&取引システム(Telegram承認含む)
Gemini AI、多時間枠分析、AFK Cryptoを使ってSolana取引を自動化する
If
Code
Wait
+
If
Code
Wait
56 ノードJeff
仮想通貨取引
n8nバックアップマスターv3
GitHubへのワークフロー自動バックアップ、メール/telegram通知対応
If
Code
Gmail
+
If
Code
Gmail
21 ノードBuilds.Cool
DevOps
ニュース自動収集プロセス → Google テーブル
NewsAPI、OpenAI、Googleスプレッドシートを使用して多言語のニュースを収集し、要約
If
Set
Code
+
If
Set
Code
19 ノードSupira Inc.
AI要約