ansible on centos 7

[root@localhost ~]# yum install ansible*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
base                                                            | 3.6 kB  00:00:00   
extras                                                          | 2.9 kB  00:00:00   
updates                                                         | 2.9 kB  00:00:00   
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
--> Running transaction check
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python-jinja2.noarch 0:2.7.2-4.el7 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-4.el7.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-4.el7.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
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-4.el7             base           519 k
 python-markupsafe         x86_64         0.11-10.el7             base            25 k
 python-paramiko           noarch         2.1.1-9.el7             base           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  2 Packages (+8 Dependent packages)

Total download size: 11 M
Installed size: 53 M
Is this ok [y/d/N]: y
Downloading packages:
(1/10): python-httplib2-0.9.2-1.el7.noarch.rpm                  | 115 kB  00:00:00   
(2/10): python-jinja2-2.7.2-4.el7.noarch.rpm                    | 519 kB  00:00:01   
(3/10): python-markupsafe-0.11-10.el7.x86_64.rpm                |  25 kB  00:00:00   
(4/10): ansible-doc-2.4.2.0-2.el7.noarch.rpm                    | 763 kB  00:00:01   
(5/10): python2-jmespath-0.9.0-3.el7.noarch.rpm                 |  39 kB  00:00:00   
(6/10): python-paramiko-2.1.1-9.el7.noarch.rpm                  | 269 kB  00:00:00   
(7/10): python-passlib-1.6.5-2.el7.noarch.rpm                   | 488 kB  00:00:00   
(8/10): sshpass-1.06-2.el7.x86_64.rpm                           |  21 kB  00:00:00   
(9/10): python-babel-0.9.6-8.el7.noarch.rpm                     | 1.4 MB  00:00:02   
(10/10): ansible-2.4.2.0-2.el7.noarch.rpm                       | 7.6 MB  00:00:27   
---------------------------------------------------------------------------------------
Total                                                     419 kB/s |  11 MB  00:27   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-httplib2-0.9.2-1.el7.noarch                                 1/10
  Installing : sshpass-1.06-2.el7.x86_64                                          2/10
  Installing : python-babel-0.9.6-8.el7.noarch                                    3/10
  Installing : python-paramiko-2.1.1-9.el7.noarch                                 4/10
  Installing : python2-jmespath-0.9.0-3.el7.noarch                                5/10
  Installing : python-passlib-1.6.5-2.el7.noarch                                  6/10
  Installing : python-markupsafe-0.11-10.el7.x86_64                               7/10
  Installing : python-jinja2-2.7.2-4.el7.noarch                                   8/10
  Installing : ansible-2.4.2.0-2.el7.noarch                                       9/10
  Installing : ansible-doc-2.4.2.0-2.el7.noarch                                  10/10
  Verifying  : python-markupsafe-0.11-10.el7.x86_64                               1/10
  Verifying  : ansible-doc-2.4.2.0-2.el7.noarch                                   2/10
  Verifying  : python-passlib-1.6.5-2.el7.noarch                                  3/10
  Verifying  : python2-jmespath-0.9.0-3.el7.noarch                                4/10
  Verifying  : python-paramiko-2.1.1-9.el7.noarch                                 5/10
  Verifying  : python-babel-0.9.6-8.el7.noarch                                    6/10
  Verifying  : ansible-2.4.2.0-2.el7.noarch                                       7/10
  Verifying  : sshpass-1.06-2.el7.x86_64                                          8/10
  Verifying  : python-jinja2-2.7.2-4.el7.noarch                                   9/10
  Verifying  : python-httplib2-0.9.2-1.el7.noarch                                10/10

Installed:
  ansible.noarch 0:2.4.2.0-2.el7           ansible-doc.noarch 0:2.4.2.0-2.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-4.el7        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 ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.181.132  netmask 255.255.255.0  broadcast 192.168.181.255
        inet6 fe80::e9b6:a1b4:d2c0:6d7b  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:ee:97  txqueuelen 1000  (Ethernet)
        RX packets 8319  bytes 12162330 (11.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3645  bytes 226738 (221.4 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 64  bytes 5568 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5568 (5.4 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 ~]#
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.103  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::e9b6:a1b4:d2c0:6d7b  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:ee:97  txqueuelen 1000  (Ethernet)
        RX packets 8329  bytes 12164682 (11.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3664  bytes 229396 (224.0 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 64  bytes 5568 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5568 (5.4 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 ~]# ssh-key
ssh-keygen   ssh-keyscan 
[root@localhost ~]# 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:
SHA256:JhvBKyZX5eX2mN9Pj5hgMicNPNalUv8QqUYcCETfD7Y root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|     o+...o      |
|     . +.= . .   |
|      + o X +    |
|     . + * % .   |
|  . + + S E =    |
|   + . * * . +   |
|      . + = . o .|
|         * . o +.|
|            o . o|
+----[SHA256]-----+
[root@localhost ~]# ssh-copy-id 192.168.0.103
The authenticity of host '192.168.0.103 (192.168.0.103)' can't be established.
ECDSA key fingerprint is SHA256:m8YpYiq0v1ChLkZk74cRLvjYcNwbQaMMjGnVvdox/7U.
ECDSA key fingerprint is MD5:7a:50:34:05:30:55:60:58:77:33:80:ff:76:e9:f1:f3.
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.0.103's password:

Number of key(s) added: 1

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

[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 ~]#

Comments