ansible key验证配置

ansible key验证配置,第1张

概述ansible的控制端与被控制主机直接若想建立连接,默认验证方式是基于key验证的,下面就是在ansible控制端创建并copy到被控制主机的详细步骤: [[email protected] ~]# ssh-keyssh-keygen ssh-keyscan[[email protected] ~]# ssh-keygenGenerating public/private rsa key ansible的控制端与被控制主机直接若想建立连接,默认验证方式是基于key验证的,下面就是在ansible控制端创建并copy到被控制主机的详细步骤:

[[email protected] ~]# ssh-keyssh-keygen   ssh-keyscan[[email protected] ~]# ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/ID_rsa):/root/.ssh/ID_rsa already exists.Overwrite (y/n)? yEnter passphrase (empty for no passphrase):Enter same passphrase again:Your IDentification has been saved in /root/.ssh/ID_rsa.Your public key has been saved in /root/.ssh/ID_rsa.pub.The key fingerprint is:SHA256:3cz6KF4I2Hy2VtIVjCKrdeT6+vtvc1AKJNxdMPBQlt8 [email protected]The key‘s randomart image is:+---[RSA 2048]----+|       . .o**+.  ||      . = +++o   ||       = +  o. . ||     +o oo.=  o E||    .o+oS +.+o   ||    . .+ = .o    ||       .+ o  .   ||       .o. oo .  ||      .+++oooo   |+----[SHA256]-----+[[email protected] ~]# ssh-copy-ID 192.168.137.130/usr/bin/ssh-copy-ID: INFO: Source of key(s) to be ×××talled: "/root/.ssh/ID_rsa.pub"/usr/bin/ssh-copy-ID: INFO: attempting to log in with the new key(s),to filter out any that are already ×××talled/usr/bin/ssh-copy-ID: INFO: 1 key(s) remain to be ×××talled -- if you are prompted Now it is to ×××tall the new keys[email protected]‘s password:Number of key(s) added: 1Now try logging into the machine,with:   "ssh ‘192.168.137.130‘"and check to make sure that only the key(s) you wanted were added.[[email protected] ~]# ssh-copy-ID 192.168.137.131/usr/bin/ssh-copy-ID: INFO: Source of key(s) to be ×××talled: "/root/.ssh/ID_rsa.pub"/usr/bin/ssh-copy-ID: INFO: attempting to log in with the new key(s),to filter out any that are already ×××talled/usr/bin/ssh-copy-ID: INFO: 1 key(s) remain to be ×××talled -- if you are prompted Now it is to ×××tall the new keys[email protected]‘s password:Number of key(s) added: 1Now try logging into the machine,with:   "ssh ‘192.168.137.131‘"and check to make sure that only the key(s) you wanted were added.[[email protected] ~]# ssh-copy-ID 192.168.137.132/usr/bin/ssh-copy-ID: INFO: Source of key(s) to be ×××talled: "/root/.ssh/ID_rsa.pub"/usr/bin/ssh-copy-ID: INFO: attempting to log in with the new key(s),to filter out any that are already ×××talled/usr/bin/ssh-copy-ID: INFO: 1 key(s) remain to be ×××talled -- if you are prompted Now it is to ×××tall the new keys[email protected]‘s password:Number of key(s) added: 1Now try logging into the machine,with:   "ssh ‘192.168.137.132‘"and check to make sure that only the key(s) you wanted were added.[[email protected] ~]# ansible all -m Ping192.168.137.131 | SUCCESS => {    "changed": false,"Ping": "pong"}192.168.137.132 | SUCCESS => {    "changed": false,"Ping": "pong"}192.168.137.130 | SUCCESS => {    "changed": false,"Ping": "pong"}[[email protected] ~]#
总结

以上是内存溢出为你收集整理的ansible key验证配置全部内容,希望文章能够帮你解决ansible key验证配置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1024536.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存