Monday, November 30, 2020

How industries are solving challenges using Ansible?


What is Ansible?

    Before an illustration of the advantages of Ansible, let us reflect on its definition, basic architecture, applications in DevOps, and reasons to use Ansible. Ansible’s definition suggests that it is an opensource tool for IT configuration management, deployment, and orchestration. Organizations could get massive improvements in productivity by resolving various automation challenges.

    The simplicity of Ansible, along with its potential for automation of complex, multi-tier IT application environments, validate its popularity. The next important concern on our agenda in this discussion should be the reasons to use Ansible. The growth of data centers all over the world, resulting in the increasing complexity of hosted applications, created problems for administrators.

    The scalability of manual systems management, according to the speed of enabling applications, became very difficult. As a result, the DevOps philosophy could not be realized completely as the IT operations team engaged constantly in system configuration. Therefore, the need for ideal server provisioning and configuration management tools became evident.

Ansible Architecture



Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.
Being designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time.

It uses no agents and no additional custom security infrastructure, so it’s easy to deploy - and most importantly, it uses a very simple language (YAML, in the form of Ansible Playbooks) that allow you to describe your automation jobs in a way that approaches plain English.

In this section, we’ll give you a really quick overview of how Ansible works so you can see how the pieces fit together.

Modules

Ansible works by connecting to your nodes and pushing out scripts called “Ansible modules” to them. Most modules accept parameters that describe the desired state of the system. Ansible then executes these modules (over SSH by default), and removes them when finished. Your library of modules can reside on any machine, and there are no servers, daemons, or databases required.

You can write your own modules, though you should first consider whether you should. Typically you’ll work with your favorite terminal program, a text editor, and probably a version control system to keep track of changes to your content. You may write specialized modules in any language that can return JSON (Ruby, Python, bash, and so on).

Module utilities

When multiple modules use the same code, Ansible stores those functions as module utilities to minimize duplication and maintenance. For example, the code that parses URLs is lib/ansible/module_utils/url.py. You can write your own module utilities as well. Module utilities may only be written in Python or in PowerShell.

Plugins

Plugins augment Ansible’s core functionality. While modules execute on the target system in separate processes (usually that means on a remote system), plugins execute on the control node within the /usr/bin/ansible process. Plugins offer options and extensions for the core features of Ansible - transforming data, logging output, connecting to inventory, and more. Ansible ships with a number of handy plugins, and you can easily write your own. For example, you can write an inventory plugin to connect to any datasource that returns JSON. Plugins must be written in Python.

Inventory

By default, Ansible represents the machines it manages in a file (INI, YAML, and so on) that puts all of your managed machines in groups of your own choosing.

To add new machines, there is no additional SSL signing server involved, so there’s never any hassle deciding why a particular machine didn’t get linked up due to obscure NTP or DNS issues.

If there’s another source of truth in your infrastructure, Ansible can also connect to that. Ansible can draw inventory, group, and variable information from sources like EC2, Rackspace, OpenStack, and more.

Here’s what a plain text inventory file looks like:

---
[webservers]
www1.example.com
www2.example.com
[dbservers]
db0.example.com
db1.example.com

Once inventory hosts are listed, variables can be assigned to them in simple text files (in a subdirectory called ‘group_vars/’ or ‘host_vars/’ or directly in the inventory file.

Or, as already mentioned, use a dynamic inventory to pull your inventory from data sources like EC2, Rackspace, or OpenStack.

Playbooks

Playbooks can finely orchestrate multiple slices of your infrastructure topology, with very detailed control over how many machines to tackle at a time. This is where Ansible starts to get most interesting.

Ansible’s approach to orchestration is one of finely-tuned simplicity, as we believe your automation code should make perfect sense to you years down the road and there should be very little to remember about special syntax or features.

Here’s what a simple playbook looks like:

---
- hosts: webservers
serial: 5 # update 5 machines at a time
roles:
- common
- webapp
- hosts: content_servers
roles:
- common
- content

The Ansible search path

Modules, module utilities, plugins, playbooks, and roles can live in multiple locations. If you write your own code to extend Ansible’s core features, you may have multiple files with similar or the same names in different locations on your Ansible control node. The search path determines which of these files Ansible will discover and use on any given playbook run.

Ansible’s search path grows incrementally over a run. As Ansible finds each playbook and role included in a given run, it appends any directories related to that playbook or role to the search path. Those directories remain in scope for the duration of the run, even after the playbook or role has finished executing. Ansible loads modules, module utilities, and plugins in this order:

  1. Directories adjacent to a playbook specified on the command line. If you run Ansible with ansible-playbook /path/to/play.yml, Ansible appends these directories if they exist:

    /path/to/modules
    /path/to/module_utils
    /path/to/plugins
    /path/to/subdir/modules
    /path/to/subdir/module_utils
    /path/to/subdir/plugins
    /path/to/roles/myrole/modules
    /path/to/roles/myrole/module_utils
    /path/to/roles/myrole/plugins
    DEFAULT_MODULE_PATH
    DEFAULT_MODULE_UTILS_PATH
    DEFAULT_CACHE_PLUGIN_PATH
    DEFAULT_FILTER_PLUGIN_PATH
    ANSIBLE_LIBRARY
    ANSIBLE_MODULE_UTILS
    ANSIBLE_CACHE_PLUGINS
    ANSIBLE_FILTER_PLUGINS

  2. Directories adjacent to a playbook that is statically imported by a playbook specified on the command line. If play.yml includes - import_playbook: /path/to/subdir/play1.yml, Ansible appends these directories if they exist:

  3. Subdirectories of a role directory referenced by a playbook. If play.yml runs myrole, Ansible appends these directories if they exist:

  4. Directories specified as default paths in ansible.cfg or by the related environment variables, including the paths for the various plugin types. See Ansible Configuration Settings for more information. Sample ansible.cfg fields:

    Sample environment variables:

  5. The standard directories that ship as part of the Ansible distribution.

System Automation




Although ansible works well with Linux based Operating system as controller nodes, Ansible can be used to automate many other Operating systems like:
  • Windows
  • OSX
  • UNIX and may others
The abundant modules provided by ansible makes it universal to use
Since Ansible is Idempotent, the efficiency of automation is high with the built-in intelligence in the tool
Things like setting up a reverse proxy server like Haproxy server is a small task but yet Automation will increase the speed of production by many times
when we use ansible, we can create multiple resources like web servers and launch Web Apps by scaling the number of servers by integrating with container technologies allowing us to create microservices too.

Cloud Infrastructure



    Nowadays, cloud instances and other Cloud services are very famous to use and Cloud Computing plays a significant role in Automation because of the high availability services and effectively Low-cost plans.
Although we have cloud services like EKS which makes it easier to set up Kubernetes, setting Kubernetes is a laborious task to be done manually. This stuff can be automated using Ansible with it's builtin or community modules created.
Ansible with the help of the Boto library can be used to automate the provisioning of AWS cloud instances like EC2 and other AWS services.


Virtualization


    Virtualization plays an important role in automation with the infrastructure that it can provide us by allowing multiple Operating systems to run parallel to another and helps us achieve virtual scaling.
But Virtualization is an advance concept and automating it will decrease the cost of human input for each and every time we need to work on Virtualization.
Ansible has the modules that can integrate with tools like:
But Virtualization is an advance concept and automating it will decrease the cost of human input for each and every time we need to work on Virtualization.
Ansible has the modules that can integrate with tools like:

  • VMware
  • Vagrant
  • Red Hat Virtualization (RHV)
  • XenServer
Ansible also can be used in Networking automation too.
Finally, Ansible automation has revolutionised the technologies and lead to a more automated and efficient Infrastructure building for many Industries and also made the automation simple with the software's ease of use.
I would like to thank Vimal Daga sir for providing this Great Knowledge and Hope you enjoyed this post and found it useful.

How Companies Use Ansible


The ongoing digital transformation coupled with the growing popularity of cloud means companies are now more dependent on dynamic, all-in-one tools that can solve multiple problems across a host of platforms.

Further, today’s organizations are looking for ways to ease into automation while also striving toward higher levels of customer satisfaction. For many organizations, the open source platform Ansible is the answer to these modern-day challenges. Here are a few examples of companies successfully implementing an Ansible migration.

HOOTSUITE




Hootsuite is a social media management system used by businesses and organizations. It allows the execution of social media campaigns on a variety of networks from a secure dashboard. Hootsuite is popular among Fortune 1000 companies.

The main challenge facing Hootsuite was the lack of repeatability. This made automating Hootsuite’s infrastructure a challenge, and Hootsuite were also facing difficulties in application deployment.

To resolve this, Hootsuite introduced Ansible core. This allowed Hootsuite to build servers from scratch and enabled repeatability. In the future, Hootsuite plans to implement an Ansible migration of its app deployment and possibly in ad hoc production server management.

Since performing their Ansible migration, Hootsuite says ops and devs ‘feel safer’. Additionally, Ansible allows developers to repeatedly test server builds on a local level until the team can be sure they work.

Hootsuite intends to use Ansible in many other ways, and as Beier Cai, Director of Technology, Hootsuite Media Inc., explains, “In the beginning I didn’t realize Ansible is good for orchestration as well but found it out quickly and I really loved it as it beats competitors right there.”

AMELCO




Amelco is a UK-based company that develops software solutions for the betting industry and financial betting markets. The business was looking for a way to deploy its applications efficiently across its hundreds of different environments, and it also sought to limit downtime. To do this, Amelco performed an Ansible migration to an agentless automation framework. This reduced the complexities it faced with the deployment, operations and the upgrade of applications over a range of contrasting locations, while also using one simplified language.

In addition, by introducing Ansible and Ansible Tower, Amelco has successfully automated its application deployments. Other benefits include reduced complexity and continuous delivery, along with speed solution delivery.

Further benefits include:

  • “Faster time to deployment for its bespoke and modular client solutions, resulting in speedier time to market and higher customer satisfaction”.

  •  “A simplified and repeatable deployment process, leveraging true multi-tier, multi-step orchestration that minimized the complex dependencies of heterogeneous environments,”.

LIFESUM




Based in Stockholm, Lifesum is a digital health platform that encourages users to lead a healthier, more balanced lifestyle. Lifesum has proved hugely successful throughout Europe, reaching over 6 million downloads so far.

Lifesum’s platform uses a host of applications, in addition to a joint back end API, and it bases its infrastructure on AWS. Lifesum was looking for a simplified yet robust tool to allow configuration management, application deployment, and server provisioning.

Prior to introducing Ansible, Lifesum had used another tool but found provisioning and managing different environments a challenge.

Lifesum started their Ansible migration in 2014. It started implementing Ansible straight away and has used it in several major areas. First, Lifesum used Ansible playbooks “to automatically spin up virtual development machines with Vagrant”.

In the case study, Michal Gasek, SYSOPS Engineer/DBA at Lifesum also notes that Lifesum’s goal, “[is] to ensure that everyone had exactly the same working environment as we deploy our applications regularly. Three months later all our environments, from developer’s laptops to production instances on Amazon, [are] fully Ansible managed.”

Gasek continues, “We use AWS Auto Scaling and pre-bake Amazon AMI images with Ansible provisioning playbooks. When EC2 instances are launched by Auto Scaling, Ansible, triggered by cloud-init, runs provisioning playbooks, once again ensuring up-to-date configuration changes are applied, and pulling the latest applications versions from repositories. Ansible has helped us to automate, significantly simplify and speed up the process of dynamic resources scaling”.

Gasek adds that Ansible stood out because of its ‘power and simplicity’. Gasek also highlights how Ansible has enabled developers to concentrate on building ‘great product features’, rather than solving common problems like inconsistencies and misconfiguration.

CONCLUSION

With today’s demand for automation, consistency and the move towards cloud, companies from all sectors are adopting easy-to-use tools that enable them to achieve these goals and overcome complexities. These three success stories show how an Ansible migration is the ideal solution for automating organizations’ modern technology challenges, while also performing an essential role in app deployment and improving responsiveness.

Thankyou For Reading.... Keep Learning.... 

No comments:

Post a Comment

Hadoop WebApp Automation

  Abstract : Today is an era of Technology and with the increase of technology the amount of data it produces increases every second even no...