• rex ssh公钥认证


    认证:
    
    前面的示例中我们演示了怎么通过用户名密码登陆,其实也可以用秘钥认证
    
    使用密钥认证只需要在Rexfile里定义你的公钥和私钥既即可:
    
    user "my-user";
    private_key "/home/user/.ssh/id_rsa";  ##私钥
    public_key "/home/user/.ssh/id_rsa.pub"; ##公钥
    key_auth;
    
    
    [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" => "start";
    };
    [root@node01 my-first-rex-project]# rex uptime
    [2017-04-29 10:16:24] INFO - Running task uptime on 192.168.137.3
     01:18:43 up 21:46,  1 user,  load average: 0.00, 0.00, 0.00
    [2017-04-29 10:16:35] INFO - All tasks successful on all hosts
    [root@node01 my-first-rex-project]# 
    

  • 相关阅读:
    mongoDb
    profile ,explain,
    header 里面的contenttype
    group by,distinct的使用(30万数据测试)
    ubuntu 12.04 mysql 错误 Errcode 13
    php curl,爬虫
    explain mysql
    php 文件的函数
    create User,grand,Load data file
    android 按钮点击测试
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349747.html
Copyright © 2020-2023  润新知