Skip to main content

这是一个灵活的自动化运维工具

Project description

iamt(本项目使用智谱GLM系列模型辅助开发)

一个灵活的自动化运维工具,提供 SSH 连接管理、Docker Compose 部署、任务执行和角色配置等功能。

功能特性

  • SSH 连接管理 - 支持密码/私钥认证,自动收集主机信息(类似 Ansible setup 模块)
  • Docker Compose 部署 - 内置 80+ 预配置模块,支持一键部署到远程服务器
  • 任务系统 - 基于 Fabric 的任务管理,支持交互式选择和配置文件执行
  • 角色系统 - 预定义的配置脚本,快速设置开发环境
  • 命令行执行 - 本地/远程命令执行,支持模糊搜索补全

安装

# 使用 pip 安装
pip install iamt -U 

# 或使用 uv 安装
uv tool install iamt -U

快速开始

1. 配置主机

首次运行时,工具会交互式引导你创建配置文件:

iamt test

或手动创建 iamt.yaml

hosts:
  my-server:
    host: 192.168.1.100
    port: 22
    user: ubuntu
    auth_method: password
    password: your-password
    sudo_password: your-sudo-password

2. Docker Compose 部署

# 列出所有可用模块
iamt dcd ls

# 交互式部署
iamt dcd x

# 从配置文件部署
iamt dcd file

3. 任务管理

# 列出所有可用任务
iamt task ls

# 交互式执行任务
iamt task run

4. 角色执行

# 列出所有可用角色
iamt role ls

# 交互式执行角色
iamt role run

CLI 命令

命令 说明
iamt test [hostname] 测试 SSH 连接
iamt list_modules 列出所有模块
iamt list_hostvars [hostname] 列出主机变量
iamt dcd ls 列出 Docker Compose 模块
iamt dcd x 交互式部署 Docker Compose
iamt dcd file 从配置文件部署
iamt task ls 列出可用任务
iamt task run 交互式执行任务
iamt role ls 列出可用角色
iamt role run 交互式执行角色
iamt rler 交互式执行远程命令
iamt rlel 交互式执行本地命令
iamt rfx 从配置文件执行任务

提示: amamtiamt 的别名,可以互换使用。

内置 Docker Compose 模块

项目内置了丰富的 Docker Compose 模板,按类别组织:

类别 模块示例
AI 客户端 OpenWebUI, LibreChat, NextChat
AI 工作流 Dify, FastGPT, n8n, LangFlow
LLM API LiteLLM, OneAPI, NewAPI
RAG RagFlow, QAnything, Kotaemon
MCP MCP Gateway, MCP Proxy
数据库 MySQL, MongoDB, PostgreSQL, Redis
存储 MinIO, Nextcloud, Seafile
监控 Prometheus, Grafana
CI/CD GitLab, SonarQube
代理 V2Ray, Mihomo
媒体 Navidrome, Koel

配置文件示例

DCD 配置文件 (.dcd.yaml)

hostname: my-server
tasks:
  - task: dcdtask.deploy_compose_module
    args:
      local_path: src/iamt/composes/5557AICLIENT/openwebui
      remote_dir: /opt/docker/openwebui
      force: false
  - task: dcdtask.compose_up
    args:
      remote_dir: /opt/docker/openwebui

Role 配置文件 (.role.yaml)

hostname: my-server
tasks:
  - task: ubuntud.setup_ubuntu_desktop
    args: {}

开发

# 克隆仓库
git clone https://github.com/lipanpan/iamt.git
cd iamt

# 创建虚拟环境
uv venv
.venv\Scripts\activate  # Windows
# source .venv/bin/activate  # Linux/macOS

# 安装开发依赖
uv pip install -e .

依赖

  • Python 3.13
  • Fabric - SSH 连接管理
  • Fire - CLI 框架
  • Rich - 终端美化输出
  • Prompt Toolkit - 交互式输入
  • Questionary - 交互式问答

作者

lipanpan (lipanpanmail@163.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iamt-1.1.49-py3-none-any.whl (10.1 MB view details)

Uploaded Python 3

File details

Details for the file iamt-1.1.49-py3-none-any.whl.

File metadata

  • Download URL: iamt-1.1.49-py3-none-any.whl
  • Upload date:
  • Size: 10.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for iamt-1.1.49-py3-none-any.whl
Algorithm Hash digest
SHA256 2f22610052d249119e71889926a39834020ee9d27f7383b2366f33c26f4a99d6
MD5 01683cbb8e60ba3c263dfbec49eb4b96
BLAKE2b-256 b8cfb73ce4964612d2088449410a76d03374cf9d239a5b106beb9d66b15a8a98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page