我希望能够使用 Rundeck 在远程节点上执行 shell 命令,我发现 this video这解释了如何做到这一点,但我不了解私钥部分以及如何配置它。我不断收到以下错误:
Authentication failure connecting to node: "test-001". Make sure your resource definitions and credentials are up to date. Failed: AuthenticationFailure: Authentication failure connecting to node: "test-001". Make sure your resource definitions and credentials are up to date.
我设置了一个远程服务器,我配置了 resource.xml 文件,如下所示:
<node name="test-001" description="demo for test" tags="demo" hostname="10.10.10.10:22" osFamily="unix" osName="Linux" osVersion="2.6.32" username="demo" />
我是否需要添加
ssh-key
xml 文件的值?如果是这样,我是否必须将公钥或私钥从 Rundeck 服务器复制到主机服务器?另外,用户名 demo 也有密码,那么我该如何定义呢?
最佳答案
Rundeck 主机服务器通过私钥认证的方式连接到节点,这与 SSH 私钥认证完全相似。按照以下步骤将节点添加到您的服务器 rundeck。
打开resources.xml 文件并添加以下内容。
<node name="rundeck node2" description="Rundeck node2" tags="node2" hostname="10.1.0.1" osArch="amd64" osFamily="unix" osName="Linux" osVersion="3.11.10-03111015-generic" username="leo" ssh-keypath="/var/lib/rundeck/node2.key"/>
您可以更改节点中的 SSH 用户名和私钥文件名。除此之外,您还可以更改所有其他命名参数,例如节点名称和标签等。
现在进入您的节点服务器。
leo@c1a5f48a6c4c:~/.ssh$ pwd
/home/leo/.ssh
leo@c1a5f48a6c4c:~/.ssh$ cat id_rsa.pub >> authorized_keys
leo@c1a5f48a6c4c:~/.ssh$ chmod g-w authorized_keys
leo@c1a5f48a6c4c:~/.ssh$ cat id_rsa
将私钥保存到 rundeck 主机上的文件“/var/lib/rundeck/node2.key”。现在身份验证正常,可以从 rundeck 仪表板执行临时命令
关于ssh - 在 rundeck 中添加远程节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36224912/