标签:设置 ret 管理 ansible 密钥 情况 change 密码 class
#ssh-keygen //生成秘钥
root@hsz:/etc/ansible# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter 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:
c5:5a:29:c4:d6:8d:f7:2c:46:f8:a3:c1:d8:e9:5b:06 root@hsz
The key‘s randomart image is:
+--[ RSA 2048]----+
| ... + |
| .o.+.+ |
| ..+== o |
| .=E = o |
| S. = o |
| o o |
| + |
| . |
| |
+-----------------+
#回车回车就行
#ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 root@192.168.0.50
#一般这样的命令就行,即被管理服务器的ssh端口默认
#ssh-copy-id 192.168.0.50
# 那么接下来就可以进行远程操作了(将被管理服务器ip加到清单的情况下)
比如ping:
[root@hsz ~]# ansible 192.168.0.50 -m ping 192.168.0.50 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "ping": "pong" }
标签:设置 ret 管理 ansible 密钥 情况 change 密码 class
原文地址:https://www.cnblogs.com/hszstudypy/p/11520275.html