Knowledge is knowledge

Terraform

 What is Terraform

  • It allows to automate and manage your infrastructure , platform, and services that run on that plateform.
  • Open source.
  • Declarative ( don't have to define every step ).
  • Tool for infrastructure provisioning.

There are two steps in deploying a project or infrastructure first is provisionoing infrastructure ( preparing server liek sequirity , installing docker etc ) and second is actually deploying the application.

Difference in Ansible and Terraform?

Both: Infrastructure as code

Both automate: provisioning, configuring and managing the infrastructure.

Terraform: Mainly infrastructure provisioning tool., relatively new, more advanced in orchestration.

Ansible: Mainly a configuration tool, more mature.

organizations uses both for there benefits dependin on use case.

Managing existing infrastructure: changes to existing infrastructure are done by Terraform. like addition of new server and security etc. it automate the continuos changes to your infrastructure.

we can also replicate existing infrastructure using terraform code used for creating infrastructure.

How does terraform work? How it connect to aws etc to do what we want.

Terraform Architecture

First

Core: compare config and current state and figure out what steps to do to achive certain state.

Take two inputs ( Tf-config file defined by user what to create, and current state of infrastructure ) .

Second

Providers 

AWS}Azure } [IaaS], Kubernetes | [PaaS]

Fastly | [SaaS]

Terraform commands for different stages

refresh: query infrastructure provider to get current state.

plan: create an execution plan.

apply: execute the plan.

destroy: destroy the resources/infrastructure.









Share:

Puppet

What is puppet?

Tool to manage and automate the configuration of servers.

There is a primary server and puppet agent 

Puppet uses a declearative languge to describe what to do not steps and the puppet primary server stores puppet code and puppet agent translates that code in commands to do that certain task. called puppet run.


 


Share:

Ansible

What is Ansible?

Tool to automate IT tasks.

Why use Ansible?

Repetitive tasks: like back ups, updates, system reboots, create user, assign goups , assign permissions etc.

manual approach will be doing ssh in one server than in another and so on.

We have to make notes of what we did in one server and then we have to do the same in another server with same steps.

Eg: Suppose you have 10 servers and you want to deploy new version of code on all 10 servers.


With Ansible all this tasks are more efficient and less time consuming.

In 4 different ways

1. Execute tasks from your own machine ( remotly without doing ssh in other servers ).

2. Configuration/Installation/Deployment steps in a single YAML File. ( Instead of manual and shell scripts )

3. Re-use same file multiple times and for different enviornments.

4. More reliable and less likely for errors.

Supporting all infrastructure from operating systems.. to cloud provider.

Ansible is agentless ( no need to install on servers install on only a main machine )

- No deployment effort in beginning

- No upgrade efforts

Ansible Architecture.

Modules ( small programs that do actual work )

modules are sent to a target machine and they do a given task and then vanish.

Ansible uses YAML files


Modules are granular and specific.

for a certain task to be done we need multiple modules working in sequence. thats where Ansible Playbooks come in to action.


in playbooks we define plays for certain module work 

like first hosts : where to execute task, remote_user : from which machine tasks should be executed.

etc.

Ansible Inventory list : here the hosts ( machine to and from tasks are to be executed , ip addresses or host names of machines)

Inventory = All the machines involved in the task executions.

Ansible for docker : can run docker container and also same image on vagrant container etc too.


Ansible Tower:

-UI dashboard from Red Hat.

- Centrally store automation tasks.

- across teams.

- configure permissions.

- manage inventory.







Share:

Basic generator control loops

 

Basic generator control loops

        In an interconnected power system , LFC (Load frequency control) and AVR (Automatic voltage regulator) equipment's are installed for each generator. ( in fig LFC and AVR loops are shown).

        Controllers are set for a particular operating condition and take care of small changes in load demand to maintain frequency and voltage within the specified limits.

        Small change in real power depend on rotar angle delta and thus frequency.

        The reactive is mainly dependent on voltage magnitude (i.e , on generator excitation).

        The excitation system time constant is much smaller than the prime mover time constant and its transient decay much faster and does not affect the LFC dynamics. Therefor cross-coupling between LFC loop and AVR loop is negligible. And the load frequency and excitation voltage control are analyzed independently.



Share:

Disjoint set union (DSU)


DisJoint set union : It is a technique in graphs used for grouping problems

    There are two functions  used (find and union )

     Find: find parent;

     Union: merge two groups with a rule;

public int find(int x,int[] par){
if(par[x]==x){
return x;
}
par[x]=find(par[x],par);
return par[x];
}
public void union(int x,int y,int[] par){
int px = find(x,par);
int py = find(y,par);
if(px!=py){
if(px<py){
par[py]=px;
}else{
par[px]=py;
} } }
Share: