ANSIBLE CLIENT CONF

liveuser@localhost ~]$ sudo su - root

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[root@localhost ~]# passwd root

Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.45.142  netmask 255.255.255.0  broadcast 192.168.45.255
        inet6 fe80::be3e:647f:728a:936  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:10:52:ce  txqueuelen 1000  (Ethernet)
        RX packets 11791  bytes 16987718 (16.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3201  bytes 202697 (197.9 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 70  bytes 5600 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 70  bytes 5600 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# service sshd status
Redirecting to /bin/systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:sshd(8)
           man:sshd_config(5)
[root@localhost ~]# service sshd start
Redirecting to /bin/systemctl start sshd.service
[root@localhost ~]# chkconfig sshd on
Note: Forwarding request to 'systemctl enable sshd.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/sshd.service to /usr/lib/systemd/system/sshd.service.
[root@localhost ~]# ssh-copy-id 192.168.45.141

/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': No such file or directory
(to install the contents of '/root/.pub' anyway, look at the -f option)
[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:82IufXWLeMgCKf4H9fscSqmh7OT+u/guwIYKYGwX7LU root@localhost
The key's randomart image is:
+---[RSA 2048]----+
|  .              |
|   o .           |
|. . o .          |
|.+ o E  .        |
|+ .o   oS.       |
|. . = +  o... .  |
|.. o o.++.+=.o . |
|.   .+o=+=*oo..  |
|     +OBO=.oo    |
+----[SHA256]-----+
[root@localhost ~]# ssh-copy-id 192.168.45.141
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.45.141 (192.168.45.141)' can't be established.
ECDSA key fingerprint is SHA256:rA7kTGM4/Hy8WcbMPjVQ5Xa6mxSmIaPrHYRqeJazWdQ.
ECDSA key fingerprint is MD5:fb:61:32:71:48:c0:1e:8a:a4:df:3c:12:87:8a:4e:7b.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/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.141's password:

Number of key(s) added: 1

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

[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# service network restart
Restarting network (via systemctl):                        [  OK  ]
[root@localhost ~]# service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service
[root@localhost ~]# chkconfig firewalld off
Note: Forwarding request to 'systemctl disable firewalld.service'.
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# yum install ansible*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
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-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
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  2 Packages (+8 Dependent packages)

Total download size: 11 M
Installed size: 53 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/python-httplib2-0.9.2-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for python-httplib2-0.9.2-1.el7.noarch.rpm is not installed
(1/10): python-httplib2-0.9.2-1.el7.noarch.rpm                  | 115 kB  00:00:01   
Public key for python-jinja2-2.7.2-3.el7_6.noarch.rpm is not installedkB  --:--:-- ETA
(2/10): python-jinja2-2.7.2-3.el7_6.noarch.rpm                  | 518 kB  00:00:01   
(3/10): ansible-doc-2.4.2.0-2.el7.noarch.rpm                    | 763 kB  00:00:01   
(4/10): python-paramiko-2.1.1-9.el7.noarch.rpm                  | 269 kB  00:00:00   
Public key for python-babel-0.9.6-8.el7.noarch.rpm is not installed
(5/10): python-babel-0.9.6-8.el7.noarch.rpm                     | 1.4 MB  00:00:02   
(6/10): python-markupsafe-0.11-10.el7.x86_64.rpm                |  25 kB  00:00:00   
(7/10): python-passlib-1.6.5-2.el7.noarch.rpm                   | 488 kB  00:00:00   
(8/10): python2-jmespath-0.9.0-3.el7.noarch.rpm                 |  39 kB  00:00:00   
(9/10): sshpass-1.06-2.el7.x86_64.rpm                           |  21 kB  00:00:00   
(10/10): ansible-2.4.2.0-2.el7.noarch.rpm                       | 7.6 MB  00:00:04   
---------------------------------------------------------------------------------------
Total                                                     2.4 MB/s |  11 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-6.1810.2.el7.centos.x86_64 (@base/$releasever)
 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/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-3.el7_6.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  : python-jinja2-2.7.2-3.el7_6.noarch                                 8/10
  Verifying  : sshpass-1.06-2.el7.x86_64                                          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-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 ~]# ssh-copy-id root@192.168.45.141
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
Enter passphrase for key '/root/.ssh/id_rsa':

/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
(if you think this is a mistake, you may want to use -f option)

[root@localhost ~]# passwd root^C
[root@localhost ~]# vi /etc/ansible/hosts

192.168.45.141
192.168.45.142


Comments

Popular posts from this blog

ansible redhat cluster qorum qdevice

PE 3.9.0 on centos 6

gfs2 cluster