Sample Ansible commands.

Running Ansible commands on remote hosts.

Ansible default inventory file is /etc/ansible/hosts which keeps list of all hosts. You can setup number of hosts within groups.

tail -n 15 /etc/ansible/hosts

Ansible Host File

How to ping all servers in ansible inventory file.

[root@ansible-master ~]# ansible all -m ping

ansible ping

Ansible all command will list all the hosts in /etc/ansible/host file, does connect to the remote servers using your current user name, over SSH.

[root@ansible-master ~]# ansible all –list-hosts

Ansible_host

Command to list servers included in dbservers group of the /etc/ansible/hosts file.

[root@ansible-master ~]# ansible dbservers –list-hosts

Ansible_DB

Ensuring if bash package has been installed on all servers under dbservers group but don’t update it: 

[root@ansible-master ~]# ansible dbservers -s -m yum -a “name=bash state=present”

Checking_Package_State

apache service should be started on all hosts under webservers groups.

[root@ansible-master ~]# ansible webservers -s -m service -a “name=httpd state=started”

Screenshot from 2016-07-27 16-45-15

Output of every ansible command will be in JSON format which can be latter used for reporting purpose.

Ansible facts

Ansible facts are a way of collecting information about remote machines for playbook variables known as facts. We always  setup module in Ansible to explore wide array of system information or custom facts modules can also be written. However, we can use simple way to provide systems or user specific information for Ansible variables.

Such As To list the available facts of machine, you can call the “setup” module.

[root@ansible-master ~]# ansible -m setup localhost

Screenshot from 2016-07-27 17-21-57

Facts can also be dumped from desired hosts and save them followed by hostname on target location.

[root@ansible-master facts]# ansible -m setup webservers –tree /tmp/facts/

Screenshot from 2016-07-27 17-32-40

Ansible filters are medium to find exact information that match this shell-style facts Such as you might want to determine the used/free memory/swap on systems and even if configuration value on another system.

[root@ansible-master facts]# ansible webservers -m setup -a ‘filter=ansible_*_mb’

Screenshot from 2016-07-27 18-01-04

 

To get IP information via ansible filter.

[root@ansible-master facts]# ansible webservers -m setup -a ‘filter=ansible_*_ipv4′

Ansible_filter

 

To get kernal information via Ansible filter.

[root@ansible-master facts]# ansible webservers -m setup -a ‘filter=ansible_kernel’

Screenshot from 2016-07-27 18-17-31

Posted in Uncategorised | Leave a comment

How to Install/Deploy Ansible on CentOS 7

Introduction:

51982

Ansible is powerful automation and configuration management tool written in python. Ansible does by default communicate with machines over the SSH protocol, Ansible is agent free, does not require any additional agent/daemons to be installed on remote machines. You will have to setup playbook to execute multiple commands for a deployment/configuration written in YAML format.

Ansible upholds four months short release cycles to tackle all minor bugs. Major bugs will still have maintenance releases whenever needed.

 

Prerequisites :            Ansible can be run from any machine with Python 2.6 or 2.7
Operating System:    RHELx, CentOS, Fedora, Debian, Ubuntu and BSD.

Nodes:

192.168.1.81        ansible-master
192.168.1.82        ansible-peer1
192.168.1.83        ansible-peer2
192.168.1.84        ansible-peer3

Step #1: Add the EPEL Repository

Ansible is part of EPEL community repository for non-standard packages, we need to first setup the EPEL repository om CentOS7.

Ansible

Once EPEL repo installation is completed, run  makecache command to  download all the metadata for the enabled yum repos.

  • yum makecache

yum update

Step #2: Update OS

Running yum update on all nodes to ensure all installed packages are up to date. While updating packages, yum will ensure that all dependencies are also installed.

  • yum update -y

DevOps

Step #3 : ssh key deployment across all hosts

Generate authentication keys for ssh using ssh-keygen. -t option reflects the type of key to be generated rsa/dsa/ecdsa.

 [root@ansible-master ~]# ssh-keygen -t dsassh_key_deployment

ssh-copy-id command logs into the remote machine with password to enable key based authentication.

  • [root@ansible-master ~]# ssh-copy-id -i .ssh/id_dsa.pub ansible-master

deploy ssh key

 Step #4 : Add all nodes into /etc/hosts

Edit the /etc/hosts file, This file is a simple text file containing IP addresses with hostnames, one line per IP address.

etc_hosts

Step #5 : Installing Ansible

While making ansible installation with yum, it does resolve all dependencies of python

  • [root@ansible-master ~]# yum install ansible -y

Ansible Installation

Step #6 : How to Check Ansible version

[root@ansible-master ~]# ansible –version

Ansible_Version

Step #7 : Add remote host in Ansible inventory (/etc/ansible/hosts) file. 

Edit the /etc/ansible/hosts file to declare the nodes or servers inventory of Ansible.

 1

The format for /etc/ansible/hosts file is an INI-like format. Object mentioned in brackets are group names, deciding what systems you are controlling for what objective.

it’s fine to define hosts in more than one group, for instance a server part of both a webservers and a dbservers

Adding_Hosts

 Step #8 :  Run the commands from Ansible.

[root@ansible-master ~]# ansible all -a “/bin/echo hello”

check host connection

[root@ansible-master ~]# ansible -m ping dbservers,application

Ansible_Ping

 [root@ansible-master ~]# ansible -m command -a ‘uptime’ dbservers,application

uptime

[root@ansible-master ~]# ansible -m command -a ‘cat /etc/redhat-release’ dbservers,application

ping_check

 

Please share/subscribe if you like this post.

Posted in Linux course online, Linux Learning, Red Hat Linux | Leave a comment

Understanding Open vSwitch

To understand what Open vSwitch is, first we need to understand virtual switching and network layer access. Earlier the servers had to physically connect to the switch in the data center. This was supposedly inconvenient if the data center and the servers were geographically apart. In that case the whole data had to be copied on the local server and then the operation could be completed. But with the introduction of VMware servers were virtualized making it possible to have to connect to a Virtual Switch instead of a real one. This Virtual Switch is software that is inside a server which hosts Virtual machines.

413651

Currently there are many options available in Virtual Switching. The three most popular among them are: (1) VMware Virtual Switch (2) Open v Switch and (3) CISCO Nexus 1000V. The first among them was the standard VMware virtual switch which was distributed along with VMware. But this switch had many problems and bugs and it was not free. The cre3ation of Open V Switch was the answer to the problems of virtual switching. It was created by a team hastily put together at Nicira, to make a virtual switch for open source. Just like Linux class Open vSwitch was a part of the open source projects. Later on it played a huge role in OpenStack training.

Open V Switch became much more than a simple virtual switch later on. It could support many virtual machine systems like port mirroring, VLANs etc and could operate both like a soft switch and also as a control switch. Some other ways Open V Switch has become a necessary part of Virtual systems and ultimately the cloud system:

  • It is critical for networking together virtual machines, which is the soul of cloud based servers.

  • Acts as the entry door for all Virtual Machines sending data or traffic to network.

  • Is excellent way to manage a muti tenant network virtual machines and cloud based computing.

  • Open v Switch also makes it possible to trade direct traffic between networks for maximizing their use.

Another major advantage of using Open v Switch is that it does not require particular software to run. As mentioned earlier it is open source and works well with all systems.

Posted in Linux, Linux course online, Linux Learning | Leave a comment

Developing Open v Switch to enhance network Virtualization.

Network virtualization and migration to cloud is the future for networking. The virtual layer 2 and 3 in Open source Virtual network abstraction is the most sought after project in Linux coaching. Open vSwitch development is also following the same pattern. Open Source networking components and capabilities are being added by Open v Switch developers.

19503

The capabilities enhancement is mainly into virtual network abstraction and the Open Virtual Security commonly known as OVS. The goal of developing Open vSwitch is implementation of quality standards making it possible to operate at all possible levels in the Virtual Network. The developers are also encouraging the use of Open v Switch in OpenStack training. The best thing about the developers working on Open v Switch is that they are working for the best of companies which use this tool. The companies which are contributing are VMware, Red Hat Linux and a startup company Socketplane.

Open v Switch is the most popular switch system in OpenStack, as it is light weight and has more capabilities than its counterparts. The design allows connecting group of Virtual machines in Layer 2 and layer 3 networks. t also allows using other physical network resources to the optimum level like switches, routers Level2,3 and 4 ACLs.

The aim of the team is to customize the Open v Switch to suit the Open Virtual Network model. The idea is to integrate with all classes of Open Virtual Networks. This design evolution means that Open vSwitch will have capabilities which no other switching tool has.

Posted in Uncategorised | Tagged , , | Leave a comment

File and Block Storage and Object Storage – The Difference

File and block storage have been used for decades and are well defined ways to store data. Object storage on the other hand is relatively new, hence the obvious question is – How different is Object storage? How is it beneficial? When can it be used? What benefits adds to the IT infrastructure? There are many related questions that need to be answered before implementing in the infrastructure. First the earlier storage system known as block and file storage should be understood, to understand the advantages and drawbacks of Object Storage.

80832

What is meant by File Storage?

When storing, a file is structured and a file system is constructed. It is a way to arrange files so that the files can be stored and retrieved using the path. Other factors that need to be described are its owner; size and the file access are all stored as metadata in the defined file system. On a local network the best way to share files is Network Attached Storage popularly known as NAS. The file is shared securely among the users. It is really a nice way to share files over a local area network. However the file storage sharing on Wide Area network has its own problems. This is because file storage uses NAS box for sharing and managing files which includes locking and unlocking. Managing billions of file sharing over a wide area network like the world wide network (Internet) is a real challenge. The system is not built to handle such huge number of files. Such limitations only have come to light in recent years with the amount of shared files increasing exponentially. Of course NAS is really good system for sharing files in the surroundings it was build for, like local sharing where the number of files and the metadata is limited.

Meaning of Block Storage

When the limitations of file storage were known, block storage was invented for storing and sharing. Large business corporations have billions of files to share, which was not possible with file storage and NAS. In Block storage the data was divided into blocks of data. These blocks were later combined to form files as and when required. Every block has an address and the block can be reached by making a SCSI call. Block storage does not require metadata except for address. The block does not have the case of owner and is an array which can be accessed as per the applied needs. It is based on performance based on database stored at a granular level. Hence the management of billions of files is not a problem. However it also has the same limitations like file storage system when shared over a wider network. When the distance increases between users the performance is affected due to call latency. Hence block storage works very well over Storage Area Networks deployed by large business enterprises

Object Storage the new way of storage and sharing

Object storage combines the best of file storage and block storage. An object is a bundle which consists of data along with all its metadata. The object is then given an identification known as the object ID. The ID depends on what the object contains including files and metadata. The object can be retrieved by using the object ID.

Object storage uses flat structure as compared to block or file storage which is granular or layered. The object storage uses the idea of pool of objects. The storage of the objects can be anywhere geographically. Since the Object ID has flat address structure retrieval is the same for local files or files elsewhere over the globe. Limitations of using metadata are also not there. The assigning of protection level and type of application it has to be used can be decided without worry of performance going down. The object can be copied to multiple locations and if required can be stored locally. Thus object storage system rides over the problems with the file and Block storage systems.

Object storage is flexible in defining metadata as per the need and opens up the opportunities for wide area sharing. The richness of data is unaffected of number of files to be handled and also the distances between storage and use. It is the best system to manage service and storage of well defined data over a wide area network.

The development of object storage was done keeping in view the development of internet. The businesses knew they had to build storage infrastructure which was large and the cost had to be reduced. Thus object storage was based on cluster storage on servers with internal access. There are exceptions where object storage is used with RAID arrays, but the scaling of data is never a problem. It can be done simply by adding nodes. Protection of data is done by object replication on one or more nodes, with exceptions like use of erasure coding for data protection.

Hence Object storage solves the problems of increase in size and amount of data to be handled. The other storage systems face issues of durability and performance which object storage easily overcomes. It allows infinite scalability by simple addition of nodes and protection by replication and relocation. The cost of managing huge data is also reduced by object storage. So to sum up object storage is good for data handling over long distances with efficient. The only limitation is for transactional data file where it fails on consistency of data. The way to go is to use all these three storage systems at the levels they are made for – File Storage for local networks, Block Storage for files requiring security and Object storage for sharing files over the internet (Wide Area Network). Knowledge of all the storage is critical for the system administrator, as it helps to identify the storage system to be used. So the end note is to know and use as per the specific needs and usability features.

Posted in Linux Learning, Openstack learning, Red Hat Linux | Leave a comment

OpenStack – Advantages of Deployment

480533

OpenStack is really coming of age as a private cloud solution. But the other side of the story is that its deployment is extremely complex. With more and more enterprise going to the cloud environment, OpenStack training has become an essential for IT professionals. Many big IT service companies like IBM and Hp are investing in OpenStack as a future of IT infrastructure.

What is the reason behind most companies talking of delving into the cloud? Well all of the companies are aware of the fast paced digital age, and what it brings with it. They have to find inventive ways to increase the efficiency, be flexible with amount and nature of data handling and on the top of it all try and reduce costs. OpenStack is the potential problem solver for all these situations. It can help control storage, processing and networking of resources. The best part is it uses Web-based system for controlling all the resources which can be spread all over the globe.

The Three Main Benefits of OpenStack Deployment

Flexibility in deployments – Deployment of OpenStack comes with the obvious benefit of flexibility it provides. The cloud based environment consists of private cloud and public cloud. Individually neither of them can solve the issues. But if they are working together almost all problems of processing, storage and efficiency are done with. It is commonly referred to as the Hybrid cloud where the projects can be moved from private cloud to public cloud and vice versa. OpenStack is what makes this possible to take advantage of both kinds of cloud systems. So some projects can utilize in-house resources on the private cloud and other projects via the public cloud. This point is included in Linux education to make it more practical as OpenStack is the system of future.

Can be customized easily – OpenStack is open source and there are no issues of licensing. It can be used as the company or the individual wants. Also if the version that you have downloaded does not fit the requirements, it can be customized as per the need. In case of Enterprise cloud systems, it has many rules regulating it, which include number of times of use and not messing with the code. Every change will cost time and money. However with OpenStack that is not the case. It can be modulated and changed as the business needs it. In other words it can be said that, OpenStack evolves with business and time.

Increases efficiency – OpenStack deployment means you can forget about putting the pieces together. It is a complete management platform. It includes networking, storage and other elements which can be operated with freedom. Almost every element required to run a cloud based system is all there. The staff can be more efficient focusing on applications within the organization. The staffing requirements change with the deployment though. The staff needs to be aware of the change and also start training on the effects of deployment. This will have a positive impact on the efficiency of the organization as a whole.

Posted in Linux, Linux course online, Linux Learning, Openstack learning, Uncategorised | Leave a comment

Why python is better for scripting

Python has been backed by Google as a scripting language. It has since become very popular for scripting. As a general high level language Python has left other languages like Lua and Tcl way behind. One of the main reasons Python is deemed good is that it blends well with data structure and can be used for any purpose with very minimal limitations. Let us take a closer look at the reasons for Python being very good for scripting. It gels well with Linux education.

linux coaching

Design of the language – Python is designed in such a way that it easily integrates with object orientation and the functional requirements of any project. The language is designed to have all the features and makes it concise and intuitive. It easily blends with paradigm languages like Java and is generally taught in Linux Course Online as the best way to script applications.

Great Syntax – The readability of any programming language is very important in it being good for scripting. Python’s syntax is well thought and has been developed keeping this critical aspect intact. It is easy to learn as it is readable and hence popular among coders, problem solvers and administrators. Even learners can easily understand the code without having to learn too much of syntax. The syntax from learning other languages comes in handy while scripting in Python.

Optimization at its best – Python takes into consideration that a high level programming language should have the optimization feature. It allows to spend more time on coding rather than testing because of the reliability of coding and the ease with which coding can be done.

Documentation and inter operability – Python is very good at making two languages work together. It is indeed great for transition from one language system to another and helps keep good codes intact so it does not need rewriting. This makes the language very efficient. Also it does not require much effort for documentation as it is in built in the language itself. This feature makes it great when going through Linux Administration Training or RHCE.

Data structure and Library availability – Python is built to integrate data structure so well that it works well when used in actual production environment. It means that scripts written in Python are scalable to handle more data without having to rewrite the code. The inbuilt library of database helps the coder and the administrator when the system is in production.

There are some more general points. Python is a complete programming solution. It is open source meaning it is free, runs on all operating systems equally well and can handle large projects and small scripting both. These are some of the reasons Linux education emphasizes learning Python if you want to go to the top of the line.

Posted in Linux, Linux course online | Tagged , , , , , , | Leave a comment

Tips to clear a technical interview

There are loads of tips available which talk about how to crack a technical interview. All interviews follow a pattern and can be cracked. First thing is to build up the confidence and prepare well. Interview success depends on many factors, if it is a technical interview. Even after having a certification like RHCE you need to brush up interview techniques every time you appear for an interview. Technical interviews are just like any other interview with some difference. Let us examine a few areas of focus.

linux education

Strong Basics – In a technical interview the basics of the programming language is a must. Whatever post you are appearing for make sure that you basics are very strong. If you are appearing for a role on the Linux platform makes sure you go through Linux Fundamentals training.  It helps to clear out the confusions.

Read Job Description carefully – Before you apply make sure you read the Job description very carefully. Job description not only defines the role you would be assigned but also has description about the technical skills. For example while turning up for recruitment for Openstack, take Openstack training manual and match it with the job description.

Be concise in answering – The interviewer will ask many questions, and the approach should be to be concise and to the point. There is no point in beating around the bush. Technical rounds are not only to gauge your knowledge but also how quickly you can use the knowledge. Reading about interview questions commonly asked can help to prepare.

Be ready to learn – The interview is mainly conducted for gauging your ability to learn. Technology is changing very rapidly and you need to be updated with the latest. Also if you do not know the answer, say so. This will reflect you candid attitude which is very essential for recruitment.

Do you homework – When appearing for the interview study the company. It will give you insights what the company does and where it is going. Assimilate this knowledge in your answers, as this is critical.

There are no shortcuts to preparing well, so the advice is to prepare well and be confident to say the least. Other things like dressing well and improving you verbal and non-verbal language are also essential.

Posted in LINUX Interview Questions, Linux Learning | Tagged , , , , , , , | Leave a comment

What is the future of Openstack?

The Tokyo summit on Openstack in October 2015 was great success. The main point of discussion was whether Openstack should remain a cloud based platform or expand to become an enterprise solution. So what is in store for Openstack or to say it in simpler words will Openstack training be in real demand among Linux professionals. Well I believe that Openstack has a great potential and future ahead. Though it is still a young technology when compared to other online Linux training courses, it is the way forward. There are many reasons for Openstack being the technology for the future. Some of the reasons are:

online linux training

Flexible and Versatile – Openstack is incredibly versatile and flexible. This is why it is becoming so popular among business. It can be adapted to all kinds of needs of all sizes of business. The low cost means that the financial barrier is not there for even the small companies to use Openstack in their IT infrastructure. Even RHCE are learning Openstack to keep up with its demand. In fact it can be used by small startups and multinationals equally well.

Speed of deployment – Speed with which a system is built is very critical to any business’ success. Openstack architecture allows transparent and speedy deployment of systems on the cloud platform. The simple operation without complications is the USP of Openstack. Most of the Linux Course Online are now offering Openstack as a separate training.

It is open source – The best part of Openstack is that it is open source. This means that it can be customized to a level which is not possible with traditional IT platforms. The users can bring in improvements as per their specific requirements. Also the unique cloud technology means many people can work together on the improvement of the technology from across the globe.

So the future is really golden for Openstack, and if the trends are true then it will rule the cloud computing arena in a couple of years. Get trained in this technology today which will be in demand through at least a decade.

Posted in Linux course online, Openstack learning | Tagged , , , , , , | Leave a comment

Advantages of Online Learning

The future of learning is through the internet and online. A recent survey revealed that nearly 4 million students are enrolled in full online degree programs, and 10 million are taking at least one online course which includes Red Hat Linux Certification. Earlier people were skeptical about learning online but more and more people are now switching to online courses. More transition has been in case of Linux education. Red hat Linux boot camp encourages online certification courses like RHCE and RHCSA. So if we take an overall perspective, what are the advantages of the success of online learning?

online red hat training,  Variety of Programs and Courses to Choose from – In the present scenario there are many options for certifications and degree courses online. Now it is possible to get all the degree certificates up to Doctorate online. Even professional certifications in software can be done online. All the exams are also migrating online. Linux Course Online is one of the popular choices for getting Linux certification.

red hat class,

More economic option – Online courses and diplomas are inexpensive. This is because there is less investment on infrastructure. Of course IT infrastructure needs to be build, but costs are lesser than running a classroom program like Red Hat Class. The costs are lesser for both students and the service providers. There is no travel costs and also low cost of text books (Downloadable content online). There are free courses also available for learning. Internet indeed is a great learning resource.

Convenient and flexible – This is the clincher for online courses. You can sit in your home and connect to take a class. With 24/7 availability, you can take classes when you want. This is great for working professionals who can earn a degree while earning money for their family. Online resources make learning even more flexible. With the advent of smart phones and tablets, it has even become easier to learn. You can take a class while travelling in the metro.

linux class

Learn while you earn – This is the biggest advantage of online courses against the traditional courses. Traditional classes have a fixed schedule and generally do not suit the working professionals. On the other hand the online courses like Openstack training can be done from anywhere at the convenience of the trainee.

Problem solving approach – Online courses take a problem solving approach to learning. So the learning is more connected with world rather than theory. This is very true for rhce training online which takes the approach of making the trainee solve real life problems. Quality of people who guide the online training and courses is also better, as these are people working in the real environment who lend their expertise to trainees.

Posted in Linux, Linux course online, Linux Learning | Tagged , , , , , , , | Leave a comment

Copyright © 2015 Spring Systems. All rights reserved.