zoukankan      html  css  js  c++  java
  • Rex 分发文件

    [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]# 

  • 相关阅读:
    论财务的意义
    项目忙乱的原因
    回家的路
    但问耕耘
    做自己的主角
    坚持的意义
    觉醒的意义
    梦想的力量
    把自己当作一件艺术品
    九宫格年度计划
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349752.html
Copyright © 2011-2022 走看看