[root@ansible ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@ansible ~]# yum update -y
[root@ansible ~]# yum -y install epel-release
[root@ansible ~]# yum list | grep ansible
ansible.noarch 2.9.25-1.el7 epel
ansible-collection-microsoft-sql.noarch 1.1.0-1.el7_9 extras
ansible-doc.noarch 2.9.25-1.el7 epel
ansible-inventory-grapher.noarch 2.4.4-1.el7 epel
ansible-lint.noarch 3.5.1-1.el7 epel
ansible-openstack-modules.noarch 0-20140902git79d751a.el7 epel
ansible-python3.noarch 2.9.25-1.el7 epel
ansible-review.noarch 0.13.4-1.el7 epel
ansible-test.noarch 2.9.25-1.el7 epel
centos-release-ansible-27.noarch 1-1.el7 extras
centos-release-ansible-28.noarch 1-1.el7 extras
centos-release-ansible-29.noarch 1-1.el7 extras
centos-release-ansible26.noarch 1-3.el7.centos extras
kubernetes-ansible.noarch 0.6.0-0.1.gitd65ebd5.el7 epel
python2-ansible-runner.noarch 1.0.1-1.el7 epel
python2-ansible-tower-cli.noarch 3.3.9-1.el7 epel
vim-ansible.noarch 3.2-1.el7 epel
[root@ansible ~]# yum install ansible -y
[root@ansible ~]# ansible --version
ansible 2.9.25
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]


[root@ansible ansible]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
SHA256:xq4BKQdAwMY2nHz5BN2n34f5F071IARdSoK/2u12sDM root@ansible
The key's randomart image is:
+---[RSA 2048]----+
|X...+ . .oo... |
| @ o o ... oo. |
|o + o o. .. |
| . o o . . . .|
| . + S ..o. .o|
| o . o ..+.. o.|
| . .o .ooo .|
| o. . E..o |
| . o.+. |
+----[SHA256]-----+


[root@ansible ansible]# ssh-copy-id 192.168.56.100
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.56.100 (192.168.56.100)' can't be established.
ECDSA key fingerprint is SHA256:kbb/xaKinLr3YzSaqvkSuYr2x4MgX50QhnIPvZH6bcI.
ECDSA key fingerprint is MD5:67:a9:14:9d:8c:8b:35:8c:48:65:eb:ea:61:20:7b:92.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.56.100's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.56.100'"
and check to make sure that only the key(s) you wanted were added.

版权声明:本文为博主原创文章,未经博主允许不得转载。

ansible