Tuesday, January 11, 2022

Ansible - Automation Essentials - Part 3 [ Parts of Ansible ]

How Ansible Works?

As already discussed, Ansible is a configuration management tool, based on push-based architecture to automate the configuration of your hosts to achieve the desired state.

Following are the components of Ansible architecture

  • Inventory - Defines the list of target hosts
  • Playbook (YAML file) - Defines a list of tasks
  • Module - A python code invoked from tasks and executed on hosts
  • Control Machine - Takes playbook and executes each task on a particular group of hosts

Playbook

A Playbook is a file that defines the desired state of your system.

It contains plays, which has a list of tasks to run in sequence against a list of hosts.

  • A play is a set of tasks, grouped together to achieve an objective
  • A task is an instruction you give to Ansible.
  • They are written in YAML format, a data serialization language, that we discussed in previous cards.

Inventory

So Ansible captured the desired state through Playbook, but how would ansible know which machines it should configure through Inventory?

The Inventory file in Ansible contains the list of all hosts (target systems/servers) that need to be configured. You can also group hosts under different names as shown:

[group A]

Host 1

[group B]

Host 2

Host N

More on Inventory

  • Default location of Inventory File: /etc/ansible/hosts
  • You can define an Inventory file statically (.ini file) or dynamically (.json file) to Ansible.

Modules Perform the Action

Modules are a piece of code that gets executed when you run a playbook. You use them to describe the state you want the host to be in.

Each task in play is made of modules and arguments.

Ansible - Automation Essentials - Part 2 [ Introduction to YAML Language ]

What is YAML?

YAML stands for Yet Another Markup Language. It is a data serialization language just like JSON.

Why YAML, when we already have JSON or XML?
  • YAML files are easy to read and write for humans, similar to English.

Foundation of YAML


  • YAML files should end as .yaml or .yml
  • Begins with --- and ends with
  • # defines comment

YAML is Case and Indentation Sensitive

  • Members of a list should be at the same indentation level starting with a dash(-) and space.
  • Each item in the list is a key: value pair (colon must be followed by a space), called a dictionary.
  • At each level, exactly two spaces are used for indentation. Using tabs is not recommended here.

Boolean Values

Variables can be defined in YAML files as shown:

stream: Java

allocated: true
allocated: yes

allocated: no

allocated: True

allocated: TRUE

allocated: false

Variables can be assigned boolean values in different ways as shown:

Data Structures

Complicated data structures are possible in YAML.

You can define lists having dictionariesdictionaries having lists or a mix of both.

In the following example,

  • name and job are dictionaries. Skill is a dictionary with a list.
  • David and Amy are listed as having dictionaries
# Employee records

- David:

name: David Moore

job: Developer

skills:

- python

- sql

- java

- Amy:

name: Amy Brown

job: Developer

skills:

- angular

- redux

- react

Ansible - Automation Essentials - Part 1 [ Introduction to Ansible in Ansible - Automation ]

What are You Going to Learn?

We hope you have gained a good understanding of what is Infrastructure as a code. In this course, you will learn about

  • Ansible and its benefits
  • Ansible in Infrastructure as Code (IaC)
  • YAML format
  • Few Ad_Hoc commands
  • Different parts of Ansible
  • Role of Modules in Ansible
  • How to write Playbooks
  • How to Control the flow of execution in Ansible
  • Few points about configuration file (ansible.cfg)
  • How to setup environment in local machine and online playground

By the end of this course, you will be in a position to write a few ad-hoc commands and a Playbook of your own.

What Is Infrastructure As Code?


IaC means writing code for infrastructure i.e. your systems and devices, which are used to run Softwares, are to be treated as software and defined using code(which can be done using a high level or descriptive language).

For example version control, testing, small deployments, use of design patterns, etc.

Configuration Management tools are used to accomplish IaC.

Why are You Here?


Infrastructure as Code can be achieved using Ansible, which is one of the popular Configuration Management tools. In this course, we will have you explore various capabilities of Ansible.

What is Configuration Management?


Configuration Management is a process of establishing, tracking and controlling the current design and build state of the system (software versions).

It also ensures that past records of system state are easily and accurately accessible which helps in project management, audit purposes, debugging etc.

Before Configuration Management

Consider you are planning for a New Year Special Sale on your e-commerce site. You need to

  • Scale up your servers
  • Then configure them(and all other old servers) for special new year sale
  • This whole process would take a lot of effort and time
  • What if new configurations did not work as expected? Then you will have to roll back to the previous stable version, which will add more work and subtract the profits and potential customers while in downtime.

Configuration Management Tools

You need some kind of Configuration Management tool that can automate these tasks:

  • Rollback to the stable version with zero downtime
  • Provide you with a constant computing environment throughout SDLC
  • Automatically scale up or down depending upon traffic

Some of the popular Configuration Management tools are Ansible, Puppet, Chef and Saltstack.

You will now learn more about Ansible in upcoming cards.

What is Ansible?


Ansible is open-source software, first released by Michael DeHaan in 2012 and owned by Red Hat.

It is used to automate

  • configuration management
  • application deployment
  • software provisioning and other IT needs

Benefits of Ansible

  • Simple: Very easy to install, set up and learn. Written in YAML file which is pretty much like reading English
  • Agentless: Do not need to install any agents on target nodes.
  • Powerful: It can model any complex IT workflow as it has 1100+ modules
  • Efficient: You can customize modules, using any programming language
  • Secure: Uses SSH for connection

Wondering about the YAML language?? Read on to discover 

Monday, January 10, 2022

Ansible - Automation Essentials - Part 0 [ Course Summary in Ansible - Automation ]


Here, we will introduce you to Ansible, how to set up and configure Ansible, execute Adhoc commands, configure roles, files, templates, etc. You will also play with Ansible Playbooks and modules.

Topics Covered

    • Ad-Hoc Commands
    • Modules - The Engine of Ansible
    • Set-Up Environment for Ansible
    • Playbook Explained
    • The Decision
    • Configuring Your Master
    • Write a PlayBook
    • Summary - Ansible
    • Ansible Final Assessment

      Please complete the entire course to get a good understanding and if you liked this then please like share and subscribe. 

      Saturday, January 1, 2022

      AWS Essentials - Part 0 [ Course Summary in AWS Cloud ]



      Introduction to AWS

      Welcome to this course on AWS Essentials!

      Here you will first learn about Cloud Computing and its characteristics. Then you will understand What is AWS, its application, and its usage. Following that, you will learn in detail about the different kinds of products AWS supports.

      Hope you had great learning! To summarize, you first

      • Learned about Cloud Computing & its characteristics
      • What is AWS & its application & usage?

      Following that deep-dived into the different offerings -

      If you like what you read please Like , share, and Subscribe to our newsletter and CodeOn Youtube Channel

      AWS Essentials - Part 10 [ Mobile Services in AWS Cloud ]

      AWS allows to easily build advanced cloud-powered applications for mobile devices! You might want to run the app on your preferred device efficiently, quickly, and securely. AWS offers the environment for this.

      Stream Real-Time Data – Gather real-time clickstream logs and react quickly. Store Shared Data – Store and query NoSQL data to users and devices. Authorize Access – Securely access cloud resources. Send Push Notifications – Keep users active by transmitting messages reliably. Deliver Media – Detect mobile devices automatically and render content quickly on a global basis. Analyze User Behavior – Track engagement and active users. Synchronize Data – Sync user preferences across devices. Manage Media – Store and share user-generated photos and other media items. Authenticate Users – Manage identity providers and users.

       Everything You Need to Build Mobile Apps

      Bountiful Cloud Services AWS provides a wide set of highly scalable, fully managed services that include data warehousing, content delivery, streaming, monitoring, databases, storage, logic, and machine learning in-app without the need to manage any infrastructure.

      The Tools To Help You Build AWS allows you to add cloud services to mobile apps easily.

      • Develop a serverless mobile backend
      • Manage user identity and sign-in
      • Transmit push notifications
      • Track usage patterns and maximize your app with in-app analytics.
      • Test against a huge set of real devices.

       AWS Offerings


      • AWS Mobile Hub - Build, Test, and Monitor Apps
      • Amazon Cognito - User Identity and App Data Synchronization
      • AWS Mobile SDK - Mobile Software Development Kit
      • Amazon API Gateway - Build, Deploy, and Manage APIs
      • Amazon Pinpoint - Push Notifications for Mobile Apps
      • AWS Device Farm - Test Android, FireOS, and iOS Apps on Real Devices in the Cloud

       Mobile Hub


      AWS Mobile Hub provides an integrated console that helps you

      • Build
      • Test and
      • Monitor & manage mobile apps.

      Mobile Hub provisions and configures the necessary AWS services and creates a working sample app.

      Cognito


      Amazon Cognito reduces the task of

      • Authenticating users, storing and managing
      • Synchronizing data across several applications, platforms, and devices.

      This functions both offline or online and enables to save user-specific data securely such as game state and application preferences.

      Cognito supports unauthenticated guest users and works with several existing identity providers.

      AWS Essentials - Part 9 [ Application Services in AWS Cloud ]

      AWS Application services have a broad range of services that helps in enhancing the rendering of the application overcloud. Main offerings include -

      Amazon Elastic Transcoder - Simple Scalable Media Transcoding Amazon API Gateway - Build, Deploy, and Manage APIs AWS Step Functions - Coordinate Distributed Applications

       Step Functions

      Offers a graphical console to set up and visualize the components of the application as a series of steps.

      • Easy to create and run multi-step applications.
      • Coordinate the components of microservices and distributed applications using visual workflows.
      • Create applications from single components that each perform a discrete function to change and scale applications quickly.
      • Triggers and tracks each step automatically, and retries when errors are noticed, which ensures your application executes as intended and in order.
      • Logs the state of every single step. When things go wrong, it is simple to diagnose and debug issues fast. You can change and include steps without the need to write code, effortlessly evolve the application and innovate rapidly.
      • Manages the underlying infrastructure and operations to ensure the application is available at all scales.

      API Gateway


      Fully managed service that allows developers to create, publish, maintain, monitor, and secure APIs easily at any scale.

      • Serves as a “front door” for applications to access functionality, data, or business logic from your back-end services, like, code running on AWS Lambda, workloads running on Amazon EC2, or any Web application.
      • Takes care of processing and accepting of concurrent API calls, including API version management, monitoring, traffic management, and authorization and access control
      • Pay only for the API calls received and the data transferred.

      How does AWS API Gateway work?

      API Gateway Benefits

      • Low-Cost and Efficient
      • Performance at Any Scale
      • Easily Monitor API Activity
      • Streamline API Development
      • Secure and Flexible
      • Flexible Security Controls
      • Create RESTful Endpoints
      • Run Your APIs Without Servers

       Elastic Transcoder

      Media transcoding in the cloud.

      Businesses and developers could transcode or convert media files from their source format into versions that will playback on devices such as PCs, tablets, and smartphones.

      It is designed to be user-friendly, economical, and highly scalable.