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

Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleKnoldus Inc.
 
Cloud native-apps-architectures
Cloud native-apps-architecturesCloud native-apps-architectures
Cloud native-apps-architecturesCapgemini
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
Cloud-Native Observability
Cloud-Native ObservabilityCloud-Native Observability
Cloud-Native ObservabilityTyler Treat
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansibleKhizer Naeem
 
CI/CD (DevOps) 101
CI/CD (DevOps) 101CI/CD (DevOps) 101
CI/CD (DevOps) 101Hazzim Anaya
 
CICD Pipelines for Microservices Best Practices
CICD Pipelines for Microservices Best Practices CICD Pipelines for Microservices Best Practices
CICD Pipelines for Microservices Best Practices Codefresh
 
Infrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsInfrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsLior Kamrat
 
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...Amazon Web Services
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICDKnoldus Inc.
 
Understanding container security
Understanding container securityUnderstanding container security
Understanding container securityJohn Kinsella
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and AlertingKhairul Zebua
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as CodeRobert Greiner
 
Continuous integration
Continuous integrationContinuous integration
Continuous integrationhugo lu
 

What's hot (20)

Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Jenkins
JenkinsJenkins
Jenkins
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
 
Ansible Playbook
Ansible PlaybookAnsible Playbook
Ansible Playbook
 
Ansible
AnsibleAnsible
Ansible
 
Cloud native-apps-architectures
Cloud native-apps-architecturesCloud native-apps-architectures
Cloud native-apps-architectures
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
Cloud-Native Observability
Cloud-Native ObservabilityCloud-Native Observability
Cloud-Native Observability
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
CI/CD (DevOps) 101
CI/CD (DevOps) 101CI/CD (DevOps) 101
CI/CD (DevOps) 101
 
Maven Nexus
Maven NexusMaven Nexus
Maven Nexus
 
CICD Pipelines for Microservices Best Practices
CICD Pipelines for Microservices Best Practices CICD Pipelines for Microservices Best Practices
CICD Pipelines for Microservices Best Practices
 
Infrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsInfrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & Tools
 
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 
Understanding container security
Understanding container securityUnderstanding container security
Understanding container security
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and Alerting
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
CI/CD on AWS
CI/CD on AWSCI/CD on AWS
CI/CD on AWS
 

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

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

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/