Saturday, March 4, 2017

puppet agent installation on Centos 6.5

First enable the puppet repository by installing the puppetlabs-release-6-10.noarch.rpm package

[root@puppet-agent ~]# rpm -ivh https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
Retrieving https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
warning: /var/tmp/rpm-tmp.FD1UUR: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
Preparing...                ########################################### [100%]
   1:puppetlabs-release     ########################################### [100%]
[root@puppet-agent ~]# yum install puppet
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.gbeservers.com
 * extras: mirrors.usinternet.com
 * updates: centos-distro.cavecreek.net
puppetlabs-deps                                                                                                                       | 2.5 kB     00:00    
puppetlabs-deps/primary_db                                                                                                            |  27 kB     00:00    
puppetlabs-products                                                                                                                   | 2.5 kB     00:00    
puppetlabs-products/primary_db                                                                                                        | 170 kB     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package puppet.noarch 0:3.8.7-1.el6 will be installed
--> Processing Dependency: ruby >= 1.8.7 for package: puppet-3.8.7-1.el6.noarch
--> Processing Dependency: ruby >= 1.8 for package: puppet-3.8.7-1.el6.noarch


Out put truncated .....

[root@puppet-agent ~]# puppet --version
3.8.7

Configuration:

1. In the main section of the puppet.conf

[root@puppet-agent ~]# vi /etc/puppet/puppet.conf

[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet
    server = skywalker.example.com


2. Allow the firewall on port 8140 or disable it if you are just testing the puppet

3. Generate the client cert

[root@puppet-agent ~]# puppet agent -t
Info: Creating a new SSL key for puppet-agent.example.com
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for puppet-agent.example.com
Info: Certificate Request fingerprint (SHA256): 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled

4. ignore the error for "waitforcecert" we yet have to sign the client from the puppet master

[root@puppet-agent ~]# puppet cert list
Notice: Signed certificate request for ca

5. Display the cert from master 

[root@skywalker puppet]# puppet cert list -a
  "puppet-agent.example.com"               (SHA256) 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6

6. Cert is signed now

 [root@skywalker puppet]# puppet cert sign puppet-agent.example.com
Signing Certificate Request for:
  "puppet-agent.example.com" (SHA256) 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6
Notice: Signed certificate request for puppet-agent.example.com
Notice: Removing file Puppet::SSL::CertificateRequest puppet-agent.example.com at '/etc/puppetlabs/puppet/ssl/ca/requests/puppet-agent.example.com.pem'

7. now run - puppet agent -t 

[root@puppet-agent ~]# puppet agent -t
Info: Caching certificate for puppet-agent.example.com
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for puppet-agent.example.com

output truncated ....

puppet agent is seen in the inventory of the puppet master to manage.




Thanks.


Friday, March 3, 2017

puppet agent Cert error - No route to the host

after installing the agent and trying to register the cert with the master server got the following error:

Resolution : Either allow client via firewall so that puppet master can talk to the client and vice versa
or stop the firewall and the error should go away.

Error: Could not request certificate: No route to host - connect(2)

Friday, February 24, 2017

Centos 7 new logical volume

[root@centos7 ~]# uname -a
Linux centos7.example.com 3.10.0-327.el7.i686 #

[root@centos7 ~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  cl_centos7   1   2   0 wz--n- 19.51g 40.00m

[root@centos7 ~]# lvcreate  -L 10M -n vol01 cl_centos7
  Rounding up size to full physical extent 12.00 MiB
  Logical volume "vol01" created.

[root@centos7 ~]# lvs
  LV    VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl_centos7 -wi-ao---- 17.47g
  swap  cl_centos7 -wi-ao----  2.00g
  vol01 cl_centos7 -wi-a----- 12.00m

[root@centos7 ~]# mkdir /devops01

[root@centos7 ~]# mkfs.ext4 /dev/cl_centos7/vol01
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
3072 inodes, 12288 blocks
614 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=12582912
2 block groups
8192 blocks per group, 8192 fragments per group
1536 inodes per group
Superblock backups stored on blocks:
        8193
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

[root@centos7 ~]# mount /dev/cl_centos7/vol01 /devops01/

[root@centos7 ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/cl_centos7-root    18G  4.7G   13G  27% /
/dev/mapper/cl_centos7-vol01   11M  204K  9.6M   3% /devops01






Tuesday, November 1, 2016

eth0 interface not found after restoring VM

eth0 interface not found after restoring rhel6 - So when the machine completed the restoring eth0 was was missing but the /etc/sysconfig/network-scripts file was still there. Found out that the configuration of the file changed to something like this -








Changed the above setting to the following -



After service network restart and the issue was fixed!

Tuesday, July 21, 2015

lspci equivalent in solaris world.


* lspci output from linux to displays all information from the PCI busses on your Linux system and all the devices connected to the busses.


testlab01# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)

................... Output truncated

I was just wondering if there is equivalent of lspci in solaris world! Here it is with the partial output as the command throws
all the devices information from the PCI buses. The location of the binary is - /usr/X11/bin/scanpci

solarislab01#  /usr/X11/bin/scanpci

pci bus 0x0000 cardnum 0x01 function 0x00: vendor 0x108e device 0x8186
 Oracle/SUN Device unknown

pci bus 0x0000 cardnum 0x02 function 0x00: vendor 0x108e device 0x8186
 Oracle/SUN Device unknown

pci bus 0x0001 cardnum 0x00 function 0x00: vendor 0x111d device 0x807a
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0003 cardnum 0x00 function 0x00: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0003 cardnum 0x00 function 0x01: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0003 cardnum 0x00 function 0x02: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0003 cardnum 0x00 function 0x03: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0004 cardnum 0x00 function 0x00: vendor 0x1000 device 0x0072
 LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]

pci bus 0x0005 cardnum 0x00 function 0x00: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0005 cardnum 0x00 function 0x01: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0005 cardnum 0x00 function 0x02: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0005 cardnum 0x00 function 0x03: vendor 0x108e device 0xabcd
 Oracle/SUN Multithreaded 10-Gigabit Ethernet Network Controller

pci bus 0x0006 cardnum 0x00 function 0x00: vendor 0x10df device 0xfc40
 Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter

pci bus 0x0006 cardnum 0x00 function 0x01: vendor 0x10df device 0xfc40
 Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter

pci bus 0x0007 cardnum 0x00 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x00 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x04 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x06 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x07 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x08 function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x0a function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x0c function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0008 cardnum 0x0f function 0x00: vendor 0x111d device 0x8077
 Integrated Device Technology, Inc. Device unknown

pci bus 0x0009 cardnum 0x00 function 0x00: vendor 0x1a03 device 0x1150
 ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge

pci bus 0x000a cardnum 0x00 function 0x00: vendor 0x1a03 device 0x2000
 ASPEED Technology, Inc. ASPEED Graphics Family

pci bus 0x000b cardnum 0x00 function 0x00: vendor 0x1000 device 0x0072
 LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]

pci bus 0x000c cardnum 0x00 function 0x00: vendor 0x8086 device 0x10c9
 Intel Corporation 82576 Gigabit Network Connection

pci bus 0x000c cardnum 0x00 function 0x01: vendor 0x8086 device 0x10c9
 Intel Corporation 82576 Gigabit Network Connection

pci bus 0x000d cardnum 0x00 function 0x00: vendor 0x8086 device 0x10c9
 Intel Corporation 82576 Gigabit Network Connection

pci bus 0x000d cardnum 0x00 function 0x01: vendor 0x8086 device 0x10c9
 Intel Corporation 82576 Gigabit Network Connection

pci bus 0x000e cardnum 0x00 function 0x00: vendor 0x10df device 0xfc40
 Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter

pci bus 0x000e cardnum 0x00 function 0x01: vendor 0x10df device 0xfc40
 Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter

pci bus 0x0011 cardnum 0x00 function 0x00: vendor 0x10b5 device 0x8112
 PLX Technology, Inc. PEX8112 x1 Lane PCI Express-to-PCI Bridge

pci bus 0x0012 cardnum 0x00 function 0x00: vendor 0x1033 device 0x0035
 NEC Corporation USB

pci bus 0x0012 cardnum 0x00 function 0x01: vendor 0x1033 device 0x0035
 NEC Corporation USB

pci bus 0x0012 cardnum 0x00 function 0x02: vendor 0x1033 device 0x00e0
 NEC Corporation USB 2.0

device unknown is nothing but the device is not in use or attached. Once the device
is in use or active the details will be shown like ex. NEC Corporation USB 2.0 as above.

Thanks.

Thursday, March 12, 2015

generate FQDN - with one liner

# cat hostname.txt

host1
host2
host3
host4

Once you run the for loop you should see something like below:

# for host in `cat hostname.txt`; do  ssh -oStrictHostKeyChecking=no $host host $host ; done | awk '{print $1}'

host1.example.com
host2.example.com
host3.example.com
host4.example.com

The output will change based on the domain name your servers are in.

Wednesday, February 25, 2015

PORT CONNECTIVITY TESTING METHODS:

Checking the port connectivity in case telnet is not installed.

Many times telnet is not installed on the production systems so in
this case port connectivity testing can be done with alternative method
by using Wget - The non-interactive network downloader Linux utility
usually available on the production systems. You can run this as regular
user without being "root" user and test the connectivity to the desired
port. Here is the example:


prodone-t> wget 10.22.176.3:5222

--2015-02-25 10:50:08--  http://10.22.176.3:5222/
Connecting to 10.22.176.3:5222... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified
Saving to: “index.html”

    [ <=>                                                                                                                 ] 305         --.-K/s   in 0s

2015-02-25 10:50:09 (29.3 MB/s) - “index.html” saved [305]

Don't worry about the error you see in index.html. That is not our goal, focus on the line-
Connecting to 10.22.176.3:5222... connected.

-------------------------------------------------------

Here is nmap example if in case you do not have either of telnet & wget:
In example 1 is checking the status of the running port. In example 2
nmap is checking the status of the port which you can make out is a non-standard
port.

example 1:

sateprod-1> nmap 10.11.160.5 -sT -p 5222

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2015-02-25 10:57 PST
Interesting ports on sateprod-1.capgroup.com (10.11.160.5):

PORT     STATE SERVICE
5222/tcp open  unknown

Nmap finished: 1 IP address (1 host up) scanned in 0.118 seconds

example 2:

sateprod-1> nmap 10.11.160.5 -sT -p 522

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2015-02-25 10:57 PST
Interesting ports on iosatprd-v1.capgroup.com (10.11.160.5):

PORT    STATE  SERVICE
522/tcp closed ulp

Nmap finished: 1 IP address (1 host up) scanned in 0.106 seconds

example 3:

Another way to test the connectivity is wget

# wget 10.120.33.23:22
# wget 10.120.33.23:69