With (R)?ex you can manage all your boxes from a central point through the complete process of configuration management and software deployment.
- 它搭配 SSH
- 感覺就像登入 SSH 操作
- 換個方向想 ,rex 讓這些變成自動化了
安裝 easy : http://rexify.org/get/index.html
測試於 CentOS 6
- rpm –import http://rex.linux-files.org/RPM-GPG-KEY-REXIFY-REPO.CENTOS6
- 匯入 yum repo
cat >/etc/yum.repos.d/rex.repo <<EOF
[rex]
name=Fedora \$releasever – \$basearch – Rex Repository
baseurl=http://rex.linux-files.org/CentOS/\$releasever/rex/\$basearch/
enabled=1
EOF - yum install rex
怎麼用 : http://rexify.org/howtos/start.html
編輯一個檔案叫 Rexfile (R要大寫)
user “root”; # ssh user
password “123456”; # ssh password
pass_auth; # 使用帳密驗證 (它也可以用key)group myserver => “1.1.1.1”, “2.2.2.2”; # 要被遠端操作的主機ip
desc “Get the uptime of all server”; # 描述這個task動作是幹麻的
task “uptime”, group => “myserver”, sub { # tasksay run “uptime”; # 此task實際的動作
};
執行 rex uptime (task的名稱) 後可得到 1.1.1.1 的 uptime 結果
[2012-08-21 15:32:15] INFO – Connecting to 1.1.1.1:22 (root)
[2012-08-21 15:32:15] INFO – Connected to 1.1.1.1, trying to authenticate.
[2012-08-21 15:32:15] INFO – Successfull authenticated.
15:32:13 up 46 min, 1 user, load average: 0.21, 0.08, 0.03
大致上是這樣子的用法
留言