Infrastructure as Code - Red Hat Ansible
Tags: ansible, infrastructure, redhat, iac
Published: 2022-11-14 14:15:31

## What is Red Hat Ansible?

Ansible is a tool for automating the provisioning and configuration of infrastructure, including both physical servers and virtual machines. It uses a simple, declarative language that is easy to learn and can be used to manage complex deployments. It is an open source project, [Ansible GitHub](https://github.com/ansible) with a large community of users and contributors. It integrates with other tools and technologies, making it a versatile tool for DevOps engineers. 

For example, Ansible can be used to automate many common tasks, such as software deployments, infrastructure deployments, configuration management, and more.


![Ansible Versions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t5utjaj58gyxxin7rcl2.png)

## Why is it interesting/exciting?

Infrastructure as code is an exciting way to manage your infrastructure. With it, you can easily automate and improve the management of your infrastructure using code. 

Red Hat Ansible is a powerful tool that makes it easy to automate your infrastructure. With it, you can quickly and easily manage your entire infrastructure from a single place. 
Using Ansible, you can also easily manage changes in your infrastructure - adding or removing machines or services without any hassle.

It uses OpenSSH for [transport](https://www.scaler.com/topics/computer-network/transport-layer-protocols/) (with other transports and pull modes as alternatives), and uses a human-readable language that is designed for getting started quickly without a lot of training

Lastly, Red Hat Ansible is scalable so you can easily add more machines or services as needed. 

## Ansible Architecture

Both editions of Ansible, Community and Ansible Automation Platform have two concepts and they are,

1. **Control node** - It is where Ansible is executed from, for example where a user runs the ansible-playbook command

2. **Managed node** - They are the devices being automated, for example a Microsoft Windows server

For automating Linux and Windows, Ansible works by connecting to managed nodes and pushing out small programs, called "Ansible modules," to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules (over SSH by default), and removes them when finished. These modules are designed to be idempotent when possible, so that they only make changes to a system when necessary.


![Ansible Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lw91qb3c79dzumruevor.png)


Let's say you want to automate your public clouds or any web service providers, Ansible will also run modules locally and talk directly to their APIs. Here are some guides,

- [Amazon Web Services Guide](https://docs.ansible.com/ansible/latest/collections/amazon/aws/docsite/guide_aws.html#ansible-collections-amazon-aws-docsite-aws-intro)

- [Google Cloud Platform Guide](https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html)

- [Microsoft Azure Guide](https://docs.ansible.com/ansible/latest/scenario_guides/guide_azure.html)