For the do-free management server password settings
1. generation management server ssh-key key
# ssh-keygen // generated keys
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:
+ - [RS 2048] ---- +
| ... + |
| .the + +.. |
| The == .. + |
| . = E = o |
| S. = o |
| oo |
| + |
| . |
| |
+-----------------+
# Return Return trip
2. The secret key is copied to the management server
#ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 [email protected]
# General such a command line , ie, the management server ssh port default
#ssh-copy-id 192.168.0.50
# Then the next it can be remotely operated (the case will be added to the list of managed server ip)
For example 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" }