跳转到内容

快速开始

优先从 GitHub Releases 下载对应平台的预编译版本:

Terminal window
cargo install rauto
Terminal window
git clone https://github.com/demohiiiii/rauto.git
cd rauto
cargo build --release

编译完成后,二进制位于 target/release/rauto

rauto 当前默认使用 linux profile,因此你可以先从 Linux 主机开始:

Terminal window
rauto exec "uname -a" \
--host 192.168.1.10 \
--username root \
--password '******'

如果目标是 Cisco、Huawei 等网络设备,建议显式指定 --device-profile

Terminal window
rauto exec "show version" \
--host 192.168.1.1 \
--username admin \
--password '******' \
--device-profile cisco
Terminal window
rauto web --bind 127.0.0.1 --port 3000

然后访问 http://127.0.0.1:3000

Web 控制台适合做这些事情:

  • 管理连接配置、模板、命令流模板
  • 执行命令、事务、工作流和编排
  • 查看异步任务、历史录制、黑名单和备份
Terminal window
rauto connection test \
--host 192.168.1.1 \
--username admin \
--password '******' \
--device-profile cisco
Terminal window
rauto connection add core-sw-01 \
--host 192.168.1.1 \
--username admin \
--ssh-port 22 \
--device-profile cisco \
--ssh-security balanced

之后可以直接按名称复用:

Terminal window
rauto exec "show version" --connection core-sw-01
Terminal window
rauto device list

内置 profile 继承自 rneter,常见包括:

  • 网络厂商:ciscohuaweih3cjuniperfortinetarista
  • 服务器:linux

如果你连的是网络设备,而不是 Linux 主机,请显式指定:

Terminal window
--device-profile cisco

rauto upload 适合 Linux 等暴露 sftp 子系统的主机;很多网络设备并不支持这一点。

一旦你进入模板、命令流、事务和编排阶段,优先使用 --connection <name> 会让命令更短,也更利于复用。