SlideShare a Scribd company logo
2
Most read
6
Most read
19
Most read
INFRASTRUCTURE AS CODE
Srinivas Kantipudi
• Agile, DevOps, CI/CD and IaC
• Introduction to Infrastructure as Code
• Tools
• Framework
• Details on the tools
• Q&A
Agenda
• Agile
• Creating software that is always ready to release
• Continuous Delivery
• A software engineering approach in which teams produce
software in short cycles, ensuring that the software can be
reliably released at any time
• DevOps
• Natural extension for Agile and Continuous delivery
• Combines development and operations
• You build it. You run it
Development
IT
Operations
Quality
Assurance
DevOps
Agile, Continuous Delivery and
DevOps
• Faster feedback
• Should be Reliable
• Tests
• Infrastructure
• Third part applications
Continuous Delivery
Mutable
• Same servers used again and
again
• Multiple patches on same server
• Manual process, can lead to
differences
Immutable
• Done through code
Mutable Vs Immutable
infrastructure
• Process of managing and provisioning of infrastructure with software
• Automate the creation and maintenance of servers
• No manual intervention
• Advantages
• Immutable infrastructure
• Speed
• Efficiency
• Accountability
Martin Fowler:
A server should be like a phoenix, regularly rising from the ashes.[1]
The primary advantage of using phoenix servers is to avoid configuration drift: ad
hoc changes to a systems configuration that go unrecorded.
Infrastructure as Code
Provisioning
• Packer
• Terraform
• Cloud Formation
• Azure Resource
Manager
Configuration
Management
• Ansible
• SaltStack
• Puppet
• Chef
Containerization
• Docker
• Vagrant
Secret management
• Vault
Tools
Playbooks
IT
Engineering
Engineering +
IT
Providers
VMware DockerNutanix AWS …
Builders
Templates
VMware DockerNutanix AWS …
Sample IaC Architecture
• Automate the creation of identical machine images
• Fast infrastructure deployment
• Multi-provider support
• Create and use Docker and Vagrant images for development
• Use AWS images for production
• Uses “Templates” which are JSON files
Introduction to Packer
Create
machine
Provision
machine
Stop
machine
Generate
image
Upload
generated
image
Packer Lifecycle
Create
machine
Provision
machine
Stop machine
Generate
image
Upload
generated
image
Packer Lifecycle
"builders": [
{
"type": "vsphere-clone",
"vcenter_server": "{{ user `vcenter_server`}}",
"username": "{{user `username`}}",
"password": "{{user `password`}}",
"insecure_connection": "{{user `insecure_conn`}}",
"vm_name": "{{user `vmname_prefix`}}-{{user
`component`}}",
"datacenter": "{{user `datacenter`}}",
"host": "{{user `host`}}",
"datastore": "{{user `datastore`}}",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"communicator": "ssh",
"CPUs": "{{user `CPUs`}}",
"RAM": "{{user `RAM`}}",
"RAM_reserve_all": "{{user `RAM_reserve_all`}}",
"linked_clone": true,
"create_snapshot": true,
"convert_to_template": true
}
• Builders turn template into a machine and
then an image
• Can have multiple builders in a template
"variables": {
"username": "{{env `VSPHERE_USER`}}",
"password": "{{env `VSPHERE_PASSWORD`}}",
"ssh_username": "{{env `SSH_USERNAME`}}",
"ssh_password": "{{env `SSH_PASSWORD`}}",
"vcenter_server": "ntvcenter02.abc.com",
},
Create
machine
Provision
machine
Stop machine
Generate
image
Upload
generated
image
Packer Lifecycle
"provisioners": [
{
"type": "ansible",
"user": "root",
"host_alias": "all",
"playbook_file": "./ansible/playbook.yml",
}
{
"type": "shell",
"inline": [
"sleep 30",
"sudo apt-get update",
"sudo apt-get install -y redis-server"
]
}
]
• Configure the booted image
• Examples
• Install Java
• Install products that we are working on
Create
machine
Provision
machine
Stop machine
Generate
image
Upload
generated
image
Packer Lifecycle
“post-processors": [
{
"type": “compress",
“output": filename.zip",
}
{
"type": “vagrant",
“outpute": “vagrantbox.box”
}
]
• Optional
• Runs after build and provision
• Used to upload artifacts or re-package
• Validating a template
• packer validate AWS_instance.json
• Building the image
• packer build AWS_instance.json
• packer build –var ‘username=user’ –var ‘password=pass’ AWS_instance.json
• packer build –var-file=variables.json AWS_instance.json
Running Packer
Playbooks
IT
Engineering
Engineering +
IT
Providers
VMware DockerNutanix AWS …
Builders
Templates
VMware DockerNutanix AWS …
Sample Architecture
• IT automation tool to configure systems
• Provides stable infrastructure for provisioning the target environments
• Agentless
• Uses SSH
• Idempotent
Introduction to Ansible
• Modules
• Stand alone scripts
• Hundreds of modules available
• Users can write their own
modules
• Playbooks
• Written in YAML
• Set of instructions
• Contains one or more plays
Ansible – Modules & Playbooks
---
- hosts: webservers
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service:
name: httpd
state: started
Playbook
Playbooks
IT
Engineering
Engineering +
IT
Providers
VMware DockerNutanix AWS …
Builders
Templates
VMware DockerNutanix AWS …
Sample Architecture
Terraform
• Building and Provisioning infrastructure
• Fully declarative configuration
Terraform Lifecycle
provider "vsphere" {
user = "${var.vmuser}"
password = "${var.vmpassword}"
vsphere_server = “server.com"
version = "1.12"
}
resource "vsphere_virtual_machine" "default" {
count = 10
name = “machine-${count.index + 1}-
${random_string.testautomationId.result}"
folder = “test"
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
num_cpus = 4
memory = 8032
guest_id = "${data.vsphere_virtual_machine.template.guest_id}“
}
Q&A

More Related Content

PDF
Getting Started with Infrastructure as Code
PDF
Introduction to docker
PDF
Terraform introduction
PDF
Terraform -- Infrastructure as Code
PPTX
Terraform
PDF
Infrastructure as Code
PPTX
Comprehensive Terraform Training
PDF
Introduction to IAC and Terraform
Getting Started with Infrastructure as Code
Introduction to docker
Terraform introduction
Terraform -- Infrastructure as Code
Terraform
Infrastructure as Code
Comprehensive Terraform Training
Introduction to IAC and Terraform

What's hot (20)

PPTX
PPTX
Docker Basics
PDF
Packer by HashiCorp
PPTX
Infrastructure-as-Code (IaC) using Terraform
PPTX
Hashicorp Corporate and Product Overview
PPTX
Kubernetes for Beginners: An Introductory Guide
PDF
Best Practices of Infrastructure as Code with Terraform
PDF
Build automated Machine Images using Packer
PPTX
Terraform
PDF
Docker 101: Introduction to Docker
PPTX
K8s in 3h - Kubernetes Fundamentals Training
PPT
Docker introduction
PPTX
Infrastructure as Code Presentation v5.pptx
PDF
Ansible 101
PPTX
Infrastructure as Code - Getting Started, Concepts & Tools
PPT
Jenkins Overview
PPTX
Kubernetes #1 intro
PDF
A Introduction of Packer
PDF
Ansible
PDF
Vmware overview
Docker Basics
Packer by HashiCorp
Infrastructure-as-Code (IaC) using Terraform
Hashicorp Corporate and Product Overview
Kubernetes for Beginners: An Introductory Guide
Best Practices of Infrastructure as Code with Terraform
Build automated Machine Images using Packer
Terraform
Docker 101: Introduction to Docker
K8s in 3h - Kubernetes Fundamentals Training
Docker introduction
Infrastructure as Code Presentation v5.pptx
Ansible 101
Infrastructure as Code - Getting Started, Concepts & Tools
Jenkins Overview
Kubernetes #1 intro
A Introduction of Packer
Ansible
Vmware overview
Ad

Similar to Infrastructure as Code (IaC) (20)

PDF
Packaging tool options
PPTX
AWS_Community_Day_2023-Chathra Serasinghe.pptx
PPTX
Automating That "Other" OS
PPTX
Building a Continuous Delivery Pipeline With Visual Studio
PPTX
Power of Azure Devops
PDF
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
PPT
Open Audit
PDF
IBM InterConnect 2015 - IIB in the Cloud
PPTX
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
PDF
Server Virtualization
PPTX
Devops architecture
PDF
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
PPTX
How HashiCorp platform tools can make the difference in development and deplo...
PPTX
Continuous Integration for OpenVMS with Jenkins
PDF
Way to cloud
PDF
Application Streaming is dead. A smart way to choose an alternative
PPTX
Simics - Break the Rules of Product Development
PPTX
Past, Present and Future of DevOps Infrastructure
PPTX
A Bit of Everything Chef
PPTX
Moving Windows Applications to the Cloud
Packaging tool options
AWS_Community_Day_2023-Chathra Serasinghe.pptx
Automating That "Other" OS
Building a Continuous Delivery Pipeline With Visual Studio
Power of Azure Devops
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Open Audit
IBM InterConnect 2015 - IIB in the Cloud
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Server Virtualization
Devops architecture
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
How HashiCorp platform tools can make the difference in development and deplo...
Continuous Integration for OpenVMS with Jenkins
Way to cloud
Application Streaming is dead. A smart way to choose an alternative
Simics - Break the Rules of Product Development
Past, Present and Future of DevOps Infrastructure
A Bit of Everything Chef
Moving Windows Applications to the Cloud
Ad

Recently uploaded (20)

PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Mathew Digital SEO Checklist Guidlines 2025
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Funds Management Learning Material for Beg
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPT
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
PPTX
Database Information System - Management Information System
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
artificial intelligence overview of it and more
PDF
Introduction to the IoT system, how the IoT system works
DOCX
Unit-3 cyber security network security of internet system
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PPTX
Internet___Basics___Styled_ presentation
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
Digital Literacy And Online Safety on internet
PPTX
t_and_OpenAI_Combined_two_pressentations
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
SASE Traffic Flow - ZTNA Connector-1.pdf
Mathew Digital SEO Checklist Guidlines 2025
SAP Ariba Sourcing PPT for learning material
Funds Management Learning Material for Beg
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
Database Information System - Management Information System
Exploring VPS Hosting Trends for SMBs in 2025
artificial intelligence overview of it and more
Introduction to the IoT system, how the IoT system works
Unit-3 cyber security network security of internet system
artificialintelligenceai1-copy-210604123353.pptx
Internet___Basics___Styled_ presentation
Sims 4 Historia para lo sims 4 para jugar
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Design_with_Watersergyerge45hrbgre4top (1).ppt
Digital Literacy And Online Safety on internet
t_and_OpenAI_Combined_two_pressentations
INTERNET------BASICS-------UPDATED PPT PRESENTATION

Infrastructure as Code (IaC)

  • 2. • Agile, DevOps, CI/CD and IaC • Introduction to Infrastructure as Code • Tools • Framework • Details on the tools • Q&A Agenda
  • 3. • Agile • Creating software that is always ready to release • Continuous Delivery • A software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time • DevOps • Natural extension for Agile and Continuous delivery • Combines development and operations • You build it. You run it Development IT Operations Quality Assurance DevOps Agile, Continuous Delivery and DevOps
  • 4. • Faster feedback • Should be Reliable • Tests • Infrastructure • Third part applications Continuous Delivery
  • 5. Mutable • Same servers used again and again • Multiple patches on same server • Manual process, can lead to differences Immutable • Done through code Mutable Vs Immutable infrastructure
  • 6. • Process of managing and provisioning of infrastructure with software • Automate the creation and maintenance of servers • No manual intervention • Advantages • Immutable infrastructure • Speed • Efficiency • Accountability Martin Fowler: A server should be like a phoenix, regularly rising from the ashes.[1] The primary advantage of using phoenix servers is to avoid configuration drift: ad hoc changes to a systems configuration that go unrecorded. Infrastructure as Code
  • 7. Provisioning • Packer • Terraform • Cloud Formation • Azure Resource Manager Configuration Management • Ansible • SaltStack • Puppet • Chef Containerization • Docker • Vagrant Secret management • Vault Tools
  • 8. Playbooks IT Engineering Engineering + IT Providers VMware DockerNutanix AWS … Builders Templates VMware DockerNutanix AWS … Sample IaC Architecture
  • 9. • Automate the creation of identical machine images • Fast infrastructure deployment • Multi-provider support • Create and use Docker and Vagrant images for development • Use AWS images for production • Uses “Templates” which are JSON files Introduction to Packer Create machine Provision machine Stop machine Generate image Upload generated image Packer Lifecycle
  • 10. Create machine Provision machine Stop machine Generate image Upload generated image Packer Lifecycle "builders": [ { "type": "vsphere-clone", "vcenter_server": "{{ user `vcenter_server`}}", "username": "{{user `username`}}", "password": "{{user `password`}}", "insecure_connection": "{{user `insecure_conn`}}", "vm_name": "{{user `vmname_prefix`}}-{{user `component`}}", "datacenter": "{{user `datacenter`}}", "host": "{{user `host`}}", "datastore": "{{user `datastore`}}", "ssh_username": "{{user `ssh_username`}}", "ssh_password": "{{user `ssh_password`}}", "communicator": "ssh", "CPUs": "{{user `CPUs`}}", "RAM": "{{user `RAM`}}", "RAM_reserve_all": "{{user `RAM_reserve_all`}}", "linked_clone": true, "create_snapshot": true, "convert_to_template": true } • Builders turn template into a machine and then an image • Can have multiple builders in a template "variables": { "username": "{{env `VSPHERE_USER`}}", "password": "{{env `VSPHERE_PASSWORD`}}", "ssh_username": "{{env `SSH_USERNAME`}}", "ssh_password": "{{env `SSH_PASSWORD`}}", "vcenter_server": "ntvcenter02.abc.com", },
  • 11. Create machine Provision machine Stop machine Generate image Upload generated image Packer Lifecycle "provisioners": [ { "type": "ansible", "user": "root", "host_alias": "all", "playbook_file": "./ansible/playbook.yml", } { "type": "shell", "inline": [ "sleep 30", "sudo apt-get update", "sudo apt-get install -y redis-server" ] } ] • Configure the booted image • Examples • Install Java • Install products that we are working on
  • 12. Create machine Provision machine Stop machine Generate image Upload generated image Packer Lifecycle “post-processors": [ { "type": “compress", “output": filename.zip", } { "type": “vagrant", “outpute": “vagrantbox.box” } ] • Optional • Runs after build and provision • Used to upload artifacts or re-package
  • 13. • Validating a template • packer validate AWS_instance.json • Building the image • packer build AWS_instance.json • packer build –var ‘username=user’ –var ‘password=pass’ AWS_instance.json • packer build –var-file=variables.json AWS_instance.json Running Packer
  • 14. Playbooks IT Engineering Engineering + IT Providers VMware DockerNutanix AWS … Builders Templates VMware DockerNutanix AWS … Sample Architecture
  • 15. • IT automation tool to configure systems • Provides stable infrastructure for provisioning the target environments • Agentless • Uses SSH • Idempotent Introduction to Ansible
  • 16. • Modules • Stand alone scripts • Hundreds of modules available • Users can write their own modules • Playbooks • Written in YAML • Set of instructions • Contains one or more plays Ansible – Modules & Playbooks --- - hosts: webservers remote_user: root tasks: - name: ensure apache is at the latest version yum: name: httpd state: latest - name: write the apache config file template: src: /srv/httpd.j2 dest: /etc/httpd.conf notify: - restart apache - name: ensure apache is running service: name: httpd state: started Playbook
  • 17. Playbooks IT Engineering Engineering + IT Providers VMware DockerNutanix AWS … Builders Templates VMware DockerNutanix AWS … Sample Architecture
  • 18. Terraform • Building and Provisioning infrastructure • Fully declarative configuration
  • 19. Terraform Lifecycle provider "vsphere" { user = "${var.vmuser}" password = "${var.vmpassword}" vsphere_server = “server.com" version = "1.12" } resource "vsphere_virtual_machine" "default" { count = 10 name = “machine-${count.index + 1}- ${random_string.testautomationId.result}" folder = “test" resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}" datastore_id = "${data.vsphere_datastore.datastore.id}" num_cpus = 4 memory = 8032 guest_id = "${data.vsphere_virtual_machine.template.guest_id}“ }
  • 20. Q&A