ansible server
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.45.136 netmask 255.255.255.0 broadcast 192.168.45.255
inet6 fe80::e9b6:a1b4:d2c0:6d7b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:28:ae:db txqueuelen 1000 (Ethernet)
RX packets 1399 bytes 108047 (105.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 251 bytes 24282 (23.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 68 bytes 5916 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5916 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:40:25:4a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# yum install ansible* openssh*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.hbcse.tifr.res.in
* extras: centos.hbcse.tifr.res.in
* updates: centos.hbcse.tifr.res.in
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Package openssh-server-7.4p1-16.el7.x86_64 already installed and latest version
Package openssh-7.4p1-16.el7.x86_64 already installed and latest version
Package openssh-clients-7.4p1-16.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.4.2.0-2.el7 will be installed
--> Processing Dependency: sshpass for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python2-jmespath for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-passlib for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-jinja2 for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.4.2.0-2.el7.noarch
---> Package ansible-doc.noarch 0:2.4.2.0-2.el7 will be installed
---> Package openssh-askpass.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-cavs.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-keycat.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-ldap.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-server-sysvinit.x86_64 0:7.4p1-16.el7 will be installed
--> Running transaction check
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python-jinja2.noarch 0:2.7.2-3.el7_6 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-3.el7_6.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-3.el7_6.noarch
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
---> Package python-passlib.noarch 0:1.6.5-2.el7 will be installed
---> Package python2-jmespath.noarch 0:0.9.0-3.el7 will be installed
---> Package sshpass.x86_64 0:1.06-2.el7 will be installed
--> Running transaction check
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
ansible noarch 2.4.2.0-2.el7 extras 7.6 M
ansible-doc noarch 2.4.2.0-2.el7 extras 763 k
openssh-askpass x86_64 7.4p1-16.el7 base 76 k
openssh-cavs x86_64 7.4p1-16.el7 base 229 k
openssh-keycat x86_64 7.4p1-16.el7 base 96 k
openssh-ldap x86_64 7.4p1-16.el7 base 112 k
openssh-server-sysvinit x86_64 7.4p1-16.el7 base 71 k
Installing for dependencies:
python-babel noarch 0.9.6-8.el7 base 1.4 M
python-httplib2 noarch 0.9.2-1.el7 extras 115 k
python-jinja2 noarch 2.7.2-3.el7_6 updates 518 k
python-markupsafe x86_64 0.11-10.el7 base 25 k
python-paramiko noarch 2.1.1-9.el7 updates 269 k
python-passlib noarch 1.6.5-2.el7 extras 488 k
python2-jmespath noarch 0.9.0-3.el7 extras 39 k
sshpass x86_64 1.06-2.el7 extras 21 k
Transaction Summary
=======================================================================================
Install 7 Packages (+8 Dependent packages)
Total download size: 12 M
Installed size: 53 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/openssh-keycat-7.4p1-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for openssh-keycat-7.4p1-16.el7.x86_64.rpm is not installed
(1/15): openssh-keycat-7.4p1-16.el7.x86_64.rpm | 96 kB 00:00:00
(2/15): openssh-askpass-7.4p1-16.el7.x86_64.rpm | 76 kB 00:00:00
(3/15): openssh-server-sysvinit-7.4p1-16.el7.x86_64.rpm | 71 kB 00:00:00
(4/15): openssh-ldap-7.4p1-16.el7.x86_64.rpm | 112 kB 00:00:00
Public key for python-httplib2-0.9.2-1.el7.noarch.rpm is not installedMB --:--:-- ETA
(5/15): python-httplib2-0.9.2-1.el7.noarch.rpm | 115 kB 00:00:00
(6/15): openssh-cavs-7.4p1-16.el7.x86_64.rpm | 229 kB 00:00:01
(7/15): ansible-doc-2.4.2.0-2.el7.noarch.rpm | 763 kB 00:00:01
(8/15): python-markupsafe-0.11-10.el7.x86_64.rpm | 25 kB 00:00:00
Public key for python-jinja2-2.7.2-3.el7_6.noarch.rpm is not installed
(9/15): python-jinja2-2.7.2-3.el7_6.noarch.rpm | 518 kB 00:00:00
(10/15): python-babel-0.9.6-8.el7.noarch.rpm | 1.4 MB 00:00:01
(11/15): python-paramiko-2.1.1-9.el7.noarch.rpm | 269 kB 00:00:00
(12/15): python-passlib-1.6.5-2.el7.noarch.rpm | 488 kB 00:00:00
(13/15): sshpass-1.06-2.el7.x86_64.rpm | 21 kB 00:00:00
(14/15): python2-jmespath-0.9.0-3.el7.noarch.rpm | 39 kB 00:00:00
(15/15): ansible-2.4.2.0-2.el7.noarch.rpm | 7.6 MB 00:00:04
---------------------------------------------------------------------------------------
Total 2.6 MB/s | 12 MB 00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-httplib2-0.9.2-1.el7.noarch 1/15
Installing : sshpass-1.06-2.el7.x86_64 2/15
Installing : python-paramiko-2.1.1-9.el7.noarch 3/15
Installing : python-babel-0.9.6-8.el7.noarch 4/15
Installing : python2-jmespath-0.9.0-3.el7.noarch 5/15
Installing : python-passlib-1.6.5-2.el7.noarch 6/15
Installing : python-markupsafe-0.11-10.el7.x86_64 7/15
Installing : python-jinja2-2.7.2-3.el7_6.noarch 8/15
Installing : ansible-2.4.2.0-2.el7.noarch 9/15
Installing : openssh-server-sysvinit-7.4p1-16.el7.x86_64 10/15
Installing : openssh-askpass-7.4p1-16.el7.x86_64 11/15
Installing : openssh-cavs-7.4p1-16.el7.x86_64 12/15
Installing : openssh-ldap-7.4p1-16.el7.x86_64 13/15
Installing : openssh-keycat-7.4p1-16.el7.x86_64 14/15
Installing : ansible-doc-2.4.2.0-2.el7.noarch 15/15
Verifying : python-markupsafe-0.11-10.el7.x86_64 1/15
Verifying : ansible-doc-2.4.2.0-2.el7.noarch 2/15
Verifying : python-passlib-1.6.5-2.el7.noarch 3/15
Verifying : openssh-keycat-7.4p1-16.el7.x86_64 4/15
Verifying : python2-jmespath-0.9.0-3.el7.noarch 5/15
Verifying : openssh-ldap-7.4p1-16.el7.x86_64 6/15
Verifying : python-babel-0.9.6-8.el7.noarch 7/15
Verifying : ansible-2.4.2.0-2.el7.noarch 8/15
Verifying : python-paramiko-2.1.1-9.el7.noarch 9/15
Verifying : openssh-cavs-7.4p1-16.el7.x86_64 10/15
Verifying : python-jinja2-2.7.2-3.el7_6.noarch 11/15
Verifying : sshpass-1.06-2.el7.x86_64 12/15
Verifying : python-httplib2-0.9.2-1.el7.noarch 13/15
Verifying : openssh-askpass-7.4p1-16.el7.x86_64 14/15
Verifying : openssh-server-sysvinit-7.4p1-16.el7.x86_64 15/15
Installed:
ansible.noarch 0:2.4.2.0-2.el7 ansible-doc.noarch 0:2.4.2.0-2.el7
openssh-askpass.x86_64 0:7.4p1-16.el7 openssh-cavs.x86_64 0:7.4p1-16.el7
openssh-keycat.x86_64 0:7.4p1-16.el7 openssh-ldap.x86_64 0:7.4p1-16.el7
openssh-server-sysvinit.x86_64 0:7.4p1-16.el7
Dependency Installed:
python-babel.noarch 0:0.9.6-8.el7 python-httplib2.noarch 0:0.9.2-1.el7
python-jinja2.noarch 0:2.7.2-3.el7_6 python-markupsafe.x86_64 0:0.11-10.el7
python-paramiko.noarch 0:2.1.1-9.el7 python-passlib.noarch 0:1.6.5-2.el7
python2-jmespath.noarch 0:0.9.0-3.el7 sshpass.x86_64 0:1.06-2.el7
Complete!
[root@localhost ~]# service sshd status
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-08-22 18:21:14 IST; 59min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1146 (sshd)
Tasks: 1
CGroup: /system.slice/sshd.service
└─1146 /usr/sbin/sshd -D
Aug 22 18:21:13 localhost.localdomain systemd[1]: Starting OpenSSH server daemon...
Aug 22 18:21:14 localhost.localdomain sshd[1146]: Server listening on 0.0.0.0 port 22.
Aug 22 18:21:14 localhost.localdomain sshd[1146]: Server listening on :: port 22.
Aug 22 18:21:14 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# ssh-keygen
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:k1diSYMBZvwieopFUC4zkrkWIfjeMS4ZPQ1cGBhy0vM root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|=+++.==..oo |
|+B= +o. .. o |
|B+.+ o . + . |
|.== E o .o o |
|.+ * = .S . |
|. * + o |
| o + |
|. . |
| |
+----[SHA256]-----+
[root@localhost ~]# ansible localhost -m ping
[WARNING]: Could not match supplied host pattern, ignoring: all
[WARNING]: provided hosts list is empty, only localhost is available
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@localhost ~]# vi /etc/ansible/hosts
[root@localhost ~]# ansible localhost 192.168.45.136 -m ping
[root@localhost ~]# ssh-copy-id root@192.168.45.136
/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.45.136's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.45.136'"
and check to make sure that only the key(s) you wanted were added.
[root@localhost ~]# ansible 192.168.45.136 -m ping
192.168.45.136 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@localhost ~]#
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.45.136 netmask 255.255.255.0 broadcast 192.168.45.255
inet6 fe80::e9b6:a1b4:d2c0:6d7b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:28:ae:db txqueuelen 1000 (Ethernet)
RX packets 1399 bytes 108047 (105.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 251 bytes 24282 (23.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 68 bytes 5916 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5916 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:40:25:4a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# yum install ansible* openssh*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.hbcse.tifr.res.in
* extras: centos.hbcse.tifr.res.in
* updates: centos.hbcse.tifr.res.in
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Package openssh-server-7.4p1-16.el7.x86_64 already installed and latest version
Package openssh-7.4p1-16.el7.x86_64 already installed and latest version
Package openssh-clients-7.4p1-16.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.4.2.0-2.el7 will be installed
--> Processing Dependency: sshpass for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python2-jmespath for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-passlib for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-jinja2 for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.4.2.0-2.el7.noarch
---> Package ansible-doc.noarch 0:2.4.2.0-2.el7 will be installed
---> Package openssh-askpass.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-cavs.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-keycat.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-ldap.x86_64 0:7.4p1-16.el7 will be installed
---> Package openssh-server-sysvinit.x86_64 0:7.4p1-16.el7 will be installed
--> Running transaction check
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python-jinja2.noarch 0:2.7.2-3.el7_6 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-3.el7_6.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-3.el7_6.noarch
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
---> Package python-passlib.noarch 0:1.6.5-2.el7 will be installed
---> Package python2-jmespath.noarch 0:0.9.0-3.el7 will be installed
---> Package sshpass.x86_64 0:1.06-2.el7 will be installed
--> Running transaction check
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
ansible noarch 2.4.2.0-2.el7 extras 7.6 M
ansible-doc noarch 2.4.2.0-2.el7 extras 763 k
openssh-askpass x86_64 7.4p1-16.el7 base 76 k
openssh-cavs x86_64 7.4p1-16.el7 base 229 k
openssh-keycat x86_64 7.4p1-16.el7 base 96 k
openssh-ldap x86_64 7.4p1-16.el7 base 112 k
openssh-server-sysvinit x86_64 7.4p1-16.el7 base 71 k
Installing for dependencies:
python-babel noarch 0.9.6-8.el7 base 1.4 M
python-httplib2 noarch 0.9.2-1.el7 extras 115 k
python-jinja2 noarch 2.7.2-3.el7_6 updates 518 k
python-markupsafe x86_64 0.11-10.el7 base 25 k
python-paramiko noarch 2.1.1-9.el7 updates 269 k
python-passlib noarch 1.6.5-2.el7 extras 488 k
python2-jmespath noarch 0.9.0-3.el7 extras 39 k
sshpass x86_64 1.06-2.el7 extras 21 k
Transaction Summary
=======================================================================================
Install 7 Packages (+8 Dependent packages)
Total download size: 12 M
Installed size: 53 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/openssh-keycat-7.4p1-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for openssh-keycat-7.4p1-16.el7.x86_64.rpm is not installed
(1/15): openssh-keycat-7.4p1-16.el7.x86_64.rpm | 96 kB 00:00:00
(2/15): openssh-askpass-7.4p1-16.el7.x86_64.rpm | 76 kB 00:00:00
(3/15): openssh-server-sysvinit-7.4p1-16.el7.x86_64.rpm | 71 kB 00:00:00
(4/15): openssh-ldap-7.4p1-16.el7.x86_64.rpm | 112 kB 00:00:00
Public key for python-httplib2-0.9.2-1.el7.noarch.rpm is not installedMB --:--:-- ETA
(5/15): python-httplib2-0.9.2-1.el7.noarch.rpm | 115 kB 00:00:00
(6/15): openssh-cavs-7.4p1-16.el7.x86_64.rpm | 229 kB 00:00:01
(7/15): ansible-doc-2.4.2.0-2.el7.noarch.rpm | 763 kB 00:00:01
(8/15): python-markupsafe-0.11-10.el7.x86_64.rpm | 25 kB 00:00:00
Public key for python-jinja2-2.7.2-3.el7_6.noarch.rpm is not installed
(9/15): python-jinja2-2.7.2-3.el7_6.noarch.rpm | 518 kB 00:00:00
(10/15): python-babel-0.9.6-8.el7.noarch.rpm | 1.4 MB 00:00:01
(11/15): python-paramiko-2.1.1-9.el7.noarch.rpm | 269 kB 00:00:00
(12/15): python-passlib-1.6.5-2.el7.noarch.rpm | 488 kB 00:00:00
(13/15): sshpass-1.06-2.el7.x86_64.rpm | 21 kB 00:00:00
(14/15): python2-jmespath-0.9.0-3.el7.noarch.rpm | 39 kB 00:00:00
(15/15): ansible-2.4.2.0-2.el7.noarch.rpm | 7.6 MB 00:00:04
---------------------------------------------------------------------------------------
Total 2.6 MB/s | 12 MB 00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-httplib2-0.9.2-1.el7.noarch 1/15
Installing : sshpass-1.06-2.el7.x86_64 2/15
Installing : python-paramiko-2.1.1-9.el7.noarch 3/15
Installing : python-babel-0.9.6-8.el7.noarch 4/15
Installing : python2-jmespath-0.9.0-3.el7.noarch 5/15
Installing : python-passlib-1.6.5-2.el7.noarch 6/15
Installing : python-markupsafe-0.11-10.el7.x86_64 7/15
Installing : python-jinja2-2.7.2-3.el7_6.noarch 8/15
Installing : ansible-2.4.2.0-2.el7.noarch 9/15
Installing : openssh-server-sysvinit-7.4p1-16.el7.x86_64 10/15
Installing : openssh-askpass-7.4p1-16.el7.x86_64 11/15
Installing : openssh-cavs-7.4p1-16.el7.x86_64 12/15
Installing : openssh-ldap-7.4p1-16.el7.x86_64 13/15
Installing : openssh-keycat-7.4p1-16.el7.x86_64 14/15
Installing : ansible-doc-2.4.2.0-2.el7.noarch 15/15
Verifying : python-markupsafe-0.11-10.el7.x86_64 1/15
Verifying : ansible-doc-2.4.2.0-2.el7.noarch 2/15
Verifying : python-passlib-1.6.5-2.el7.noarch 3/15
Verifying : openssh-keycat-7.4p1-16.el7.x86_64 4/15
Verifying : python2-jmespath-0.9.0-3.el7.noarch 5/15
Verifying : openssh-ldap-7.4p1-16.el7.x86_64 6/15
Verifying : python-babel-0.9.6-8.el7.noarch 7/15
Verifying : ansible-2.4.2.0-2.el7.noarch 8/15
Verifying : python-paramiko-2.1.1-9.el7.noarch 9/15
Verifying : openssh-cavs-7.4p1-16.el7.x86_64 10/15
Verifying : python-jinja2-2.7.2-3.el7_6.noarch 11/15
Verifying : sshpass-1.06-2.el7.x86_64 12/15
Verifying : python-httplib2-0.9.2-1.el7.noarch 13/15
Verifying : openssh-askpass-7.4p1-16.el7.x86_64 14/15
Verifying : openssh-server-sysvinit-7.4p1-16.el7.x86_64 15/15
Installed:
ansible.noarch 0:2.4.2.0-2.el7 ansible-doc.noarch 0:2.4.2.0-2.el7
openssh-askpass.x86_64 0:7.4p1-16.el7 openssh-cavs.x86_64 0:7.4p1-16.el7
openssh-keycat.x86_64 0:7.4p1-16.el7 openssh-ldap.x86_64 0:7.4p1-16.el7
openssh-server-sysvinit.x86_64 0:7.4p1-16.el7
Dependency Installed:
python-babel.noarch 0:0.9.6-8.el7 python-httplib2.noarch 0:0.9.2-1.el7
python-jinja2.noarch 0:2.7.2-3.el7_6 python-markupsafe.x86_64 0:0.11-10.el7
python-paramiko.noarch 0:2.1.1-9.el7 python-passlib.noarch 0:1.6.5-2.el7
python2-jmespath.noarch 0:0.9.0-3.el7 sshpass.x86_64 0:1.06-2.el7
Complete!
[root@localhost ~]# service sshd status
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-08-22 18:21:14 IST; 59min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1146 (sshd)
Tasks: 1
CGroup: /system.slice/sshd.service
└─1146 /usr/sbin/sshd -D
Aug 22 18:21:13 localhost.localdomain systemd[1]: Starting OpenSSH server daemon...
Aug 22 18:21:14 localhost.localdomain sshd[1146]: Server listening on 0.0.0.0 port 22.
Aug 22 18:21:14 localhost.localdomain sshd[1146]: Server listening on :: port 22.
Aug 22 18:21:14 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# ssh-keygen
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:k1diSYMBZvwieopFUC4zkrkWIfjeMS4ZPQ1cGBhy0vM root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|=+++.==..oo |
|+B= +o. .. o |
|B+.+ o . + . |
|.== E o .o o |
|.+ * = .S . |
|. * + o |
| o + |
|. . |
| |
+----[SHA256]-----+
[root@localhost ~]# ansible localhost -m ping
[WARNING]: Could not match supplied host pattern, ignoring: all
[WARNING]: provided hosts list is empty, only localhost is available
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@localhost ~]# vi /etc/ansible/hosts
[root@localhost ~]# ansible localhost 192.168.45.136 -m ping
[root@localhost ~]# ssh-copy-id root@192.168.45.136
/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.45.136's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.45.136'"
and check to make sure that only the key(s) you wanted were added.
[root@localhost ~]# ansible 192.168.45.136 -m ping
192.168.45.136 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@localhost ~]#
Comments
Post a Comment