Wednesday, June 21, 2017

Execute ansible-playbook faster




Execute ansible faster:

Set the below value in /etc/ansible/ansible.cfg (or) wherever your configuration file is:

------------------------------
[ssh_connection]
pipelining = True
------------------------------




How this helps? 

===========================

pipelining

Enabling pipelining reduces the number of SSH operations required to execute a module on the remote server, by executing many ansible modules without actual file transfer. This can result in a very significant performance improvement when enabled, however when using “sudo:” operations you must first disable ‘requiretty’ in /etc/sudoers on all managed hosts.
By default, this option is disabled to preserve compatibility with sudoers configurations that have requiretty (the default on many distros), but is highly recommended if you can enable it, eliminating the need for Accelerated Mode:

pipelining = False
===========================
Source:  http://docs.ansible.com/ansible/intro_configuration.html#pipelining

Bringup a network interface






========================

If the interface(for eg: eth0) is not UP automatically on system boot, you can temporarily  bring up the interface like:

# dhclient <eth0>

========================

To make it permanent, edit /etc/sysconfig/network-scripts/ifcfg-eth0
Set ONBOOT as yes as:
---------------------------
...
ONBOOT=yes
---------------------------

========================
Here, eth0 is the interface configured.


Tuesday, June 20, 2017

Progress of copy operation


See progress while carrying out copy operation: 

rsync --info=progress2 <source> <destination>

While using cp command, there is currently no direct way to check the progress..you can make use of rsync with 'info' flag as above to see the progress of copy operation.



Tuesday, June 13, 2017

port opened in your machine



Check whether a specific port is opened on your machine:

You can make use of "netstat -tuplen"

# netstat -tuplen



For example, httpd (apache) server listens @ 80 port

# netstat -tuplen | grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      0          269550     15610/httpd        





Tuesday, June 6, 2017

sudo su to execute bash( and avoid sh)




Problem:

"sudo su" does not read /etc/bashrc and executes "sh" instead of bash



Solution:

You need to add the following lines in your /root/.bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


that's it.