SlideShare a Scribd company logo
1 of 21
Download to read offline
Infrastructure as Code (IaC)
with Ansible
Definition
• Infrastructure as Code (IaC) is the management of
infrastructure (networks, virtual machines, load balancers,
and connection topology) in a descriptive model. Like the
principle that the same source code generates the same
binary, an IaC model generates the same environment
every time it is applied.
Why?
• IaC evolved to solve the problem of environment drift in the
release pipeline. Without IaC, teams must register
somewhere and maintain the settings of each individual
deployment environments. Over time, each environment
becomes a snowflake, that is, a unique configuration that
cannot be reproduced automatically. Inconsistency among
environments leads to issues during deployments. With
snowflakes, administration and maintenance of
infrastructure involves manual processes, which were hard
to track and more susceptible to errors.
Microsoft
Benefits
• The value of IaC can be broken down into three measurable categories:
Cost (reduction), speed (faster execution) and risk (remove errors and
security violations).

• Cost reduction aims at helping not only the enterprise financially, but also
in terms of people and effort, meaning that by removing the manual
component, people are able to refocus their efforts towards other
enterprise tasks.

• Infrastructure automation enables speed through faster execution when
configuring your infrastructure and aims at providing visibility to help
other teams across the enterprise work quickly and more efficiently.

• Automation removes the risk associated with human error, like manual
misconfiguration; removing this can decrease downtime and increase
reliability.
Wikipedia
Approaches
• Declarative

Defines the desired state and the system executes what
needs to happen to achieve that desired state. 

• Imperative

Imperative defines specific commands that need to be
executed in the appropriate order to end with the desired
conclusion.
Methods
• Push vs. Pull

The main difference is the manner in which the servers are
told how to be configured. In the pull method the server to be
configured will pull its configuration from the controlling
server. In the push method the controlling server pushes the
configuration to the destination system.
Idempotence
• Idempotence is a principle of Infrastructure as Code. It is
the property that a deployment command always sets the
target environment into the same configuration, regardless
of the environment’s starting state. Idempotency is
achieved by either automatically configuring an existing
target or by discarding the existing target and recreating a
fresh environment.
Good Practices
1. Codify everything

The configuration files represent the single source of truth of
your infrastructure specifications and describe exactly which
components you’ll use, how they relate to one another, and
how the entire environment is configured.

Infrastructure can then be deployed quickly and seamlessly,
and ideally no one should log into a server to manually make
adjustments.

Codify all the infrastructure things!
Good Practices
2. Document as little as possible

Your IaC code will essentially be your documentation, so
there shouldn’t be many additional instructions than that.
Good Practices
3. Maintain version control

Just like with application code, source control tools like Git,
Mercurial, Subversion, or others should be used to maintain
versions of your IaC codebase. Not only will this provide an
audit trail for code changes, it will also provide the ability to
collaborate, peer-review, and test IaC code before it goes live.
Good Practices
4. Continuously test, integrate, and deploy

Continuous testing, integration, and deployment processes
are a great way to manage all the changes that may be made
to your infrastructure code.
Good Practices
5. Make your infrastructure code modular

Developing smaller, modular units of code that can be
deployed independently of the rest of a product’s
components, is a trend in software development
(microservices), as it's a good idea in IaC as well.
Good Practices
6. Make your infrastructure immutable (when possible)

The idea behind immutable infrastructure is that IT
infrastructure components are replaced for each deployment,
instead of changed in-place.

Making your infrastructure immutable provides consistency,
avoids configuration drift, and restricts the impact of
undocumented changes to your stack. It also improves
security and makes troubleshooting easier due to the lack of
configuration edits.
Tools
Why Ansible?
What for?
Benefits
Demo
• Hello world

1. Install Ansible in controller and set up SSH in nodes

2. Edit (or create) hosts file

3. Run Ansible (ad hoc)

ansible all --user=dbezerra -k -m ping
ansible all --user=dbezerra -k -m shell -a "echo 1234 > /tmp/numbers.txt"
Demo
• Hello world (Playbook)

1. Install Ansible in the controller and set up SSH in nodes

2. Create playbook (provisioning.yml)

3. Run playbook

ansible-playbook -i hosts provisioning.yml
Demo
• GLPI 9.3.3 (MariaDB 10.3) Playbook
References
• https://docs.ansible.com/

• https://docs.ansible.com/ansible/latest/user_guide/
intro_getting_started.html

• https://www.ansible.com/resources/videos/quick-start-video

• https://docs.ansible.com/ansible/latest/modules/
modules_by_category.html

• https://docs.ansible.com/ansible/latest/user_guide/
playbooks_best_practices.html?highlight=best%20practices

• https://galaxy.ansible.com/docs/

More Related Content

What's hot

An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...Amazon Web Services
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineAnatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineRobert McDermott
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Waysmalltown
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & IntroductionLee Trout
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...Simplilearn
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with AnsibleMartin Etmajer
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformDevOps.com
 
Terratest with Terraform
Terratest with TerraformTerratest with Terraform
Terratest with TerraformKnoldus Inc.
 
Getting Started with Infrastructure as Code
Getting Started with Infrastructure as CodeGetting Started with Infrastructure as Code
Getting Started with Infrastructure as CodeWinWire Technologies Inc
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as CodeRobert Greiner
 

What's hot (20)

Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...
CI/CD Pipeline Security: Advanced Continuous Delivery Best Practices: Securit...
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineAnatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
Effective terraform
Effective terraformEffective terraform
Effective terraform
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with Terraform
 
Terratest with Terraform
Terratest with TerraformTerratest with Terraform
Terratest with Terraform
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 
Getting Started with Infrastructure as Code
Getting Started with Infrastructure as CodeGetting Started with Infrastructure as Code
Getting Started with Infrastructure as Code
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 
DevOps explained
DevOps explainedDevOps explained
DevOps explained
 
Jenkins
JenkinsJenkins
Jenkins
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Ansible Playbook
Ansible PlaybookAnsible Playbook
Ansible Playbook
 

Similar to Infrastructure as Code with Ansible

Infrastructure as Code principles and practices
Infrastructure as Code  principles and practicesInfrastructure as Code  principles and practices
Infrastructure as Code principles and practicesOpenSense Labs
 
Infrastructure as Code & its Impact on DevOps
Infrastructure as Code & its Impact on DevOps Infrastructure as Code & its Impact on DevOps
Infrastructure as Code & its Impact on DevOps Bahaa Al Zubaidi
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science PlatformDecision Science Community
 
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docx
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docxEmpowering DevOps Harnessing Infrastructure as Code Services at HEX64.docx
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docxAwijeet Kumar
 
Testing in the new age of DevOps
Testing in the new age of DevOpsTesting in the new age of DevOps
Testing in the new age of DevOpsMoataz Mahmoud
 
Application of Data Mining Techniques for Improving Continuous Integration
Application of Data Mining Techniques for Improving Continuous IntegrationApplication of Data Mining Techniques for Improving Continuous Integration
Application of Data Mining Techniques for Improving Continuous IntegrationDr. Amarjeet Singh
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitectureABDEL RAHMAN KARIM
 
Culture is more important than competence in IT outsourcing
Culture is more important than competence in IT outsourcingCulture is more important than competence in IT outsourcing
Culture is more important than competence in IT outsourcingBJIT Ltd
 
Application Darwinism - Why Most Enterprise Apps Will Evolve to the Cloud
Application Darwinism - Why Most Enterprise Apps Will Evolve to the CloudApplication Darwinism - Why Most Enterprise Apps Will Evolve to the Cloud
Application Darwinism - Why Most Enterprise Apps Will Evolve to the CloudSkytap Cloud
 
Cloud(Ansible, Kubernete)
Cloud(Ansible, Kubernete)Cloud(Ansible, Kubernete)
Cloud(Ansible, Kubernete)종일 김
 
Softchoice Webinar: IBM PureSystems launch
 Softchoice Webinar: IBM PureSystems launch Softchoice Webinar: IBM PureSystems launch
Softchoice Webinar: IBM PureSystems launchSoftchoice Corporation
 
Securing the Cloud Native stack
Securing the Cloud Native stackSecuring the Cloud Native stack
Securing the Cloud Native stackHector Tapia
 
Culture Is More Important Than Competence In IT.pptx
Culture Is More Important Than Competence In IT.pptxCulture Is More Important Than Competence In IT.pptx
Culture Is More Important Than Competence In IT.pptxmushrunayasmin
 
Securing the Cloud Native Stack
Securing the Cloud Native StackSecuring the Cloud Native Stack
Securing the Cloud Native StackApcera
 
Enabling multicloud in the enterprise with DevSecOps
Enabling multicloud in the enterprise with DevSecOpsEnabling multicloud in the enterprise with DevSecOps
Enabling multicloud in the enterprise with DevSecOpsJosh Boyd
 
Top 3 Useful Tools for DevOps Automation -
Top 3 Useful Tools for DevOps Automation -Top 3 Useful Tools for DevOps Automation -
Top 3 Useful Tools for DevOps Automation -Urolime Technologies
 
Devops phase-1
Devops phase-1Devops phase-1
Devops phase-1G R VISHAL
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupMatt Ray
 

Similar to Infrastructure as Code with Ansible (20)

Infrastructure as Code principles and practices
Infrastructure as Code  principles and practicesInfrastructure as Code  principles and practices
Infrastructure as Code principles and practices
 
Infrastructure as Code & its Impact on DevOps
Infrastructure as Code & its Impact on DevOps Infrastructure as Code & its Impact on DevOps
Infrastructure as Code & its Impact on DevOps
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science Platform
 
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docx
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docxEmpowering DevOps Harnessing Infrastructure as Code Services at HEX64.docx
Empowering DevOps Harnessing Infrastructure as Code Services at HEX64.docx
 
Testing in the new age of DevOps
Testing in the new age of DevOpsTesting in the new age of DevOps
Testing in the new age of DevOps
 
Application of Data Mining Techniques for Improving Continuous Integration
Application of Data Mining Techniques for Improving Continuous IntegrationApplication of Data Mining Techniques for Improving Continuous Integration
Application of Data Mining Techniques for Improving Continuous Integration
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
 
Microservices
MicroservicesMicroservices
Microservices
 
Culture is more important than competence in IT outsourcing
Culture is more important than competence in IT outsourcingCulture is more important than competence in IT outsourcing
Culture is more important than competence in IT outsourcing
 
Application Darwinism - Why Most Enterprise Apps Will Evolve to the Cloud
Application Darwinism - Why Most Enterprise Apps Will Evolve to the CloudApplication Darwinism - Why Most Enterprise Apps Will Evolve to the Cloud
Application Darwinism - Why Most Enterprise Apps Will Evolve to the Cloud
 
Cloud(Ansible, Kubernete)
Cloud(Ansible, Kubernete)Cloud(Ansible, Kubernete)
Cloud(Ansible, Kubernete)
 
Softchoice Webinar: IBM PureSystems launch
 Softchoice Webinar: IBM PureSystems launch Softchoice Webinar: IBM PureSystems launch
Softchoice Webinar: IBM PureSystems launch
 
Securing the Cloud Native stack
Securing the Cloud Native stackSecuring the Cloud Native stack
Securing the Cloud Native stack
 
Culture Is More Important Than Competence In IT.pptx
Culture Is More Important Than Competence In IT.pptxCulture Is More Important Than Competence In IT.pptx
Culture Is More Important Than Competence In IT.pptx
 
Securing the Cloud Native Stack
Securing the Cloud Native StackSecuring the Cloud Native Stack
Securing the Cloud Native Stack
 
Enabling multicloud in the enterprise with DevSecOps
Enabling multicloud in the enterprise with DevSecOpsEnabling multicloud in the enterprise with DevSecOps
Enabling multicloud in the enterprise with DevSecOps
 
Top 3 Useful Tools for DevOps Automation -
Top 3 Useful Tools for DevOps Automation -Top 3 Useful Tools for DevOps Automation -
Top 3 Useful Tools for DevOps Automation -
 
Devops phase-1
Devops phase-1Devops phase-1
Devops phase-1
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native Meetup
 
Cloud Analytics and VDI
Cloud Analytics and VDICloud Analytics and VDI
Cloud Analytics and VDI
 

Recently uploaded

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Infrastructure as Code with Ansible

  • 1. Infrastructure as Code (IaC) with Ansible
  • 2. Definition • Infrastructure as Code (IaC) is the management of infrastructure (networks, virtual machines, load balancers, and connection topology) in a descriptive model. Like the principle that the same source code generates the same binary, an IaC model generates the same environment every time it is applied.
  • 3. Why? • IaC evolved to solve the problem of environment drift in the release pipeline. Without IaC, teams must register somewhere and maintain the settings of each individual deployment environments. Over time, each environment becomes a snowflake, that is, a unique configuration that cannot be reproduced automatically. Inconsistency among environments leads to issues during deployments. With snowflakes, administration and maintenance of infrastructure involves manual processes, which were hard to track and more susceptible to errors. Microsoft
  • 4. Benefits • The value of IaC can be broken down into three measurable categories: Cost (reduction), speed (faster execution) and risk (remove errors and security violations). • Cost reduction aims at helping not only the enterprise financially, but also in terms of people and effort, meaning that by removing the manual component, people are able to refocus their efforts towards other enterprise tasks. • Infrastructure automation enables speed through faster execution when configuring your infrastructure and aims at providing visibility to help other teams across the enterprise work quickly and more efficiently. • Automation removes the risk associated with human error, like manual misconfiguration; removing this can decrease downtime and increase reliability. Wikipedia
  • 5. Approaches • Declarative Defines the desired state and the system executes what needs to happen to achieve that desired state. • Imperative Imperative defines specific commands that need to be executed in the appropriate order to end with the desired conclusion.
  • 6. Methods • Push vs. Pull The main difference is the manner in which the servers are told how to be configured. In the pull method the server to be configured will pull its configuration from the controlling server. In the push method the controlling server pushes the configuration to the destination system.
  • 7. Idempotence • Idempotence is a principle of Infrastructure as Code. It is the property that a deployment command always sets the target environment into the same configuration, regardless of the environment’s starting state. Idempotency is achieved by either automatically configuring an existing target or by discarding the existing target and recreating a fresh environment.
  • 8. Good Practices 1. Codify everything The configuration files represent the single source of truth of your infrastructure specifications and describe exactly which components you’ll use, how they relate to one another, and how the entire environment is configured. Infrastructure can then be deployed quickly and seamlessly, and ideally no one should log into a server to manually make adjustments. Codify all the infrastructure things!
  • 9. Good Practices 2. Document as little as possible Your IaC code will essentially be your documentation, so there shouldn’t be many additional instructions than that.
  • 10. Good Practices 3. Maintain version control Just like with application code, source control tools like Git, Mercurial, Subversion, or others should be used to maintain versions of your IaC codebase. Not only will this provide an audit trail for code changes, it will also provide the ability to collaborate, peer-review, and test IaC code before it goes live.
  • 11. Good Practices 4. Continuously test, integrate, and deploy Continuous testing, integration, and deployment processes are a great way to manage all the changes that may be made to your infrastructure code.
  • 12. Good Practices 5. Make your infrastructure code modular Developing smaller, modular units of code that can be deployed independently of the rest of a product’s components, is a trend in software development (microservices), as it's a good idea in IaC as well.
  • 13. Good Practices 6. Make your infrastructure immutable (when possible) The idea behind immutable infrastructure is that IT infrastructure components are replaced for each deployment, instead of changed in-place. Making your infrastructure immutable provides consistency, avoids configuration drift, and restricts the impact of undocumented changes to your stack. It also improves security and makes troubleshooting easier due to the lack of configuration edits.
  • 14. Tools
  • 18. Demo • Hello world 1. Install Ansible in controller and set up SSH in nodes 2. Edit (or create) hosts file 3. Run Ansible (ad hoc) ansible all --user=dbezerra -k -m ping ansible all --user=dbezerra -k -m shell -a "echo 1234 > /tmp/numbers.txt"
  • 19. Demo • Hello world (Playbook) 1. Install Ansible in the controller and set up SSH in nodes 2. Create playbook (provisioning.yml) 3. Run playbook ansible-playbook -i hosts provisioning.yml
  • 20. Demo • GLPI 9.3.3 (MariaDB 10.3) Playbook
  • 21. References • https://docs.ansible.com/ • https://docs.ansible.com/ansible/latest/user_guide/ intro_getting_started.html • https://www.ansible.com/resources/videos/quick-start-video • https://docs.ansible.com/ansible/latest/modules/ modules_by_category.html • https://docs.ansible.com/ansible/latest/user_guide/ playbooks_best_practices.html?highlight=best%20practices • https://galaxy.ansible.com/docs/