[root@node01 my-first-rex-project]# cat Rexfile
use Rex -feature => ['1.0'];
user "root";
private_key "/root/.ssh/id_rsa";
public_key "/root/.ssh/id_rsa.pub";
key_auth;
group myservers => "192.168.137.3";
desc "Get the uptime of all servers";
task "uptime", group => "myservers", sub {
my $output = run "uptime";
say $output;
};
desc "Start Mysql Service";
task "start_mysql", group => "myservers", sub {
service "mysql" => "stop";
};
task "upload_file", group => "myservers", sub {
file "/etc/ntp.conf",
source => "ntp.conf"
};
[root@node01 my-first-rex-project]# rex upload_file
[2017-04-25 13:21:31] INFO - Running task upload_file on 192.168.137.3
[2017-04-25 13:21:32] INFO - All tasks successful on all hosts
[root@node01 my-first-rex-project]#
Rex 分发文件
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
crontab并发文件锁的使用
这是学习笔记的第 1907篇文章
crontab并发文件锁的使用 -
ios开发文件管理 ios开发文件和数据
iOS开发 plist文件操作|更新:2015-02-05 19:57 1 2 3 4 5分步阅读 iOS开发常用数据存储方式有:NSKeyedArchiver、NSUserDefaults、Write写入方式、SQL
ios开发文件管理 移动开发 xcode 数据库 plist文件