Ansible: Run commands in background in playbooks?

Ansible is really picking up the market because of its simplicity and have a long way to reach Puppet. In this post we will see on how to execute remote commands in background. Advantages of running commands in background is of two

Read More

Ansible:Do task if host belongs to specific operating system and version

Some times we require to run specific commands on specific operating systems. This is because some commands will work in one distribution and other will not work. Ansible is good at dealing with this type of situations with three variables 1)ansible_distribution 2)ansible_distribution_release

Read More

How to rotate logs manually in Linux?

In Linux every activity is monitored and logged in to their respective logs in /var/log folder. The depth of log information is dependent on the log configuration we did it in /etc/logrotate.d and we have to rotate them all the time to

Read More

Basic Nginx troubleshooting in Linux/Unix

This is a small post on how to start troubleshooting Nginx server. If you are facing an issue with nginx or any server/service the first thing to conform is if our configurations are correct or not. Nginx have two commands to show

Read More

Linux:Copy, change permissions and ownership of a file in a command

Today I came across a requirement to copy couple of files and change permissions to execute those files when writing some ansible playbooks. We can do this by using cp, chmod, chown command as shown below. Ownership is changed from root user

Read More

How to force logout a user from Linux/Unix servers

Today I come across a requirement where you have to force a user to logout from a terminal. When I contacted the user and he said he did not logged in. But the thing is I can see the login session from

Read More

PFOTD: Python enumerate() function examples

Today our python built-in function is enumerate() which is very much useful to generate iterator element along with index. Need of enumerate() function in Python: Some times we require to generate a sequence of elements in a list or tuple along with their index.

Read More

How to sort SQL table by column?

Today I come across with a complex sql query requirement where I have to filter a table on a column entry and then sort according to date. The SQL language have some inbuilt keywords like ORDER to sort out this type of

Read More

Learn python try and except statements with examples

The try and except statements in python helps us to mitigate exception errors with a meaning full way. To understand why we require try and except statements we should know how python handles execution and syntax errors. There are two types of errors

Read More

Difference between Python range and xrange functions?

Python have two builtin functions which are useful to generate a sequence of numbers. These two functions are useful when you want to do iteration using for loop. Though both of the functions do same work like generating sequence but the way

Read More

banner