Skip to content
Welcome To Charanjit Cheema Blog

Welcome To Charanjit Cheema Blog

An Open Source and Cloud Blog

Menu
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
Menu

Dawn of Infrastructure as a Code a new method of Datacenter infrastructure management and provisioning.

Posted on September 24, 2018April 23, 2024 by Charanjit Cheema

Earlier in Datacenter Infrastructure were manage and provision through traditional way of physical hardware configuration or interactive configuration tool but now Infrastructure as a code has changed the picture of managing and provisioning the Infrastructure. Infrastructure as a code or IaC is the process of managing and provisioning computer data centers through machine-readable definition files.

Terraform one of the example of infrastructure as a code software developed by HashiCorp. It enable the user to build datacenter infrastructure with the help of high level configuration language on Private Cloud such as OpenStack or on Public Clouds like AWS, Microsoft Azure, Google Cloud Platform, IBM Cloud (formerly Bluemix), Oracle Cloud Infrastructure, or VMware vSphere Infrastructure.

The Infrastructure as a code is just like a programming scripts which is developed for automate the IT process. Codes are written in high level language or any descriptive language use to automate the series of static steps which must be repeated numerous times across multiple servers.

It is an ideal for DevOps environment as not only System Admin is require to perform Provisioning, Configuration management and Deployment of Infrastructure, Developer can also perform this activity only by writing the code in the language.

As Infrastructure as a code is adopted by DevOps it follows the Software design practice in which Codes versions are carefully controlled, Iteration of test are done and limit the deployment till the software is proven and approved to deployed in production.

There are many Infrastructure as Code capability tools which can be useful in deployment and configuration management like: vagrant, ansible, puppet, docker makes the whole process even easier. AWS is providing RESTful APIs that can be leveraged.

Below is the example of Ansible Play book which installs mysql-server on the remote machine (server), ensures that mysql is running, creates a user with the password, deletes the test database, creates the ansible_example database, copies a sql dump on to the machine, and restores it into ansible_example database.:

---
- hosts: server
  sudo: yes
  sudo_user: root

  tasks:

  - name: install mysql-server
    apt: name=mysql-server state=present update_cache=yes

  - name: install ansible dependencies
    apt: name=python-mysqldb state=present

  - name: Ensure mysql is running 
    service: name=mysql state=started

  - name: Create user with the password and all previleges
    mysql_user: login_user=root login_password="" name={{ mysql_user }} password={{ mysql_password }} priv=*.*:ALL host=% state=present

  - name: Delete test database
    mysql_db: name=test state=absent

  - name: Create ansible_example database
    mysql_db: name=ansible_example state=present

  - name: Copy mysql back up dump to the remote_user
    copy: src=dump.sql.bz2 dest=/tmp

  - name: Restore the dump into ansible_example database
    mysql_db: name=ansible_example state=import target=/tmp/dump.sql.bz2

Another example of AWS Cloud formation in this infrastructure-as-code example, the resource is WebServer in an AWS CloudFormation template.

AWS CloudFormation infrastructure as code

Loading

  • Author
  • Recent Posts
Charanjit Cheema
Follow him
Charanjit Cheema
Charanjit is currently working as a Cloud Architect at Mphasis, with 17 years of experience in IT infrastructure projects, implementation, and support. While his main role is as a DevOps engineer, he holds a Cloud Architect position and has strong skills in cloud technologies and automation. His expertise includes Terraform, Ansible, AWS, Azure DevOps, Azure Cloud, VMware, and Linux systems.

Charanjit is passionate about automating tasks and improving processes. He uses tools like Terraform and Azure DevOps to build and manage cloud infrastructure and streamline deployment. He also enjoys using Shell scripts and Ansible playbooks to make systems run more efficiently.

In his free time, Charanjit enjoys learning about new technologies and sharing his knowledge through his blog. When he’s not working, he likes listening to music, having a cup of coffee, and relaxing in nature.

You can connect with Charanjit on Twitter, Facebook, LinkedIn, or email him at charanjit.cheema@cjcheema.com.
Charanjit Cheema
Follow him
Latest posts by Charanjit Cheema (see all)
  • How to optimize the performance of Ansible Automation Platform or Ansible Tower - July 16, 2023
  • How to fix code and text file linting errors with the help of Visual Studio Code - June 27, 2023
  • How to migrate existing WordPress blog from AWS EC2 instance to Amazon Lightsail - May 29, 2023

Like this:

Like Loading...

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags

AWS Cloud Computing Dockers Networking Open Networking OpenSource RHEL-CentOS SDN Server Hardware SLES tcpdump Ubuntu WSL

Follow me @

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Posts

  • How to Deploy Docker Containers with NGINX on AWS EC2 Using Ansible and GitHub Actions
  • No More DynamoDB! Use Native S3 locking for Terraform State
  • How to Bring and Manage Manually Created AWS Resources Under Terraform Management
  • Iterating Cloud Resource Provisioning Using Terraform Count and For_Each Meta-Arguments
  • Terraform and Ansible Collaboration for AWS Cloud Deployment

Recent Comments

  1. Charanjit Singh on Terraform and Ansible Collaboration for AWS Cloud Deployment
  2. christinatodd2020aeaa798563 on Terraform and Ansible Collaboration for AWS Cloud Deployment
  3. Charanjit Singh on How to Set password policy in CentOS or RHEL system
  4. SAURABH on How to recover or rebuild initramfs in CentOS 7 Linux
  5. Sangita on How to Set password policy in CentOS or RHEL system

Archives

  • April 2025
  • February 2025
  • January 2025
  • August 2024
  • July 2024
  • June 2024
  • January 2024
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • September 2022
  • August 2022
  • July 2020
  • May 2020
  • February 2020
  • November 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018

Categories

  • Automation
  • Cloud Computing
  • Coding
  • CyberSecurity
  • Networking
  • OpenSource
  • RHEL-CentOS
  • Server Hardware
  • SLES
  • Technical Blog
  • Ubuntu
  • WSL

Blog Stats

  • 18,353 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
© 2025 Welcome To Charanjit Cheema Blog | Powered by Superbs Personal Blog theme
%d