SlideShare a Scribd company logo
Introduction to Ansible
Krishantha Dinesh Msc, MIEEE, MBCS
Software Architect
www.krishantha.com
www.youtube.com/krish
@krishantha
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Configuration management
• Manage software on top of hardware
• Maintain consistency based on functionality and design
• It is systems engineering process for establishing and maintaining consistency of a product's performance
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Why Configuration Management
• Make consistency
• Maintain integrity
• No need separate log in / execution on each server
• Centralize control / management
• Scaling made easy
• No time to deploy or configure after successful build
• Rolling back is easy
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
What is ansible
• Ansible is an open-source software provisioning, configuration management, and application-deployment tool.
• It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows.
• Its pushed based configuration management tool
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Why ansible
• Free. Ansible is an open-source tool.
• Very simple to set up and use. No special coding skills are necessary to use Ansible’s playbooks
• Powerful. Ansible lets you model even highly complex IT workflows.
• Flexible. You can orchestrate the entire application environment no matter where it’s deployed. You can also customize
it based on your needs.
• Agentless. You don’t need to install any other software or firewall ports on the client systems you want to automate.
You also don’t have to set up a separate management structure.
• Efficient. Because you don’t need to install any extra software, there’s more room for application resources on your
server.
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Ansible Architecture
• Modules
• Modules are like small programs that Ansible pushes out from a control machine to all the nodes / remote hosts.
• The modules are executed using playbooks.
• They control things such as services, packages and files. Ansible executes all the modules for installing updates or
whatever the required task is, and then removes them when finished.
• Ansible provides 400+ modules for common tasks
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
• Plugins
• As many other tools and platforms, plugins are extra pieces of code that augment functionality.
• Ansible comes with a number of its own plugins.
• we can write your own as well.
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
• Inventory
• All the machines you’re using with Ansible (the control machine plus nodes) are listed in a single simple file, with
their IP addresses, names etc.
• Once you list the inventory, you can assign variables to any of the hosts using a simple text file.
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
• Playbook
• Ansible playbooks are like instruction manuals for tasks.
• They are simple files written in YAML. (human-readable data serialization language).
• Playbooks are really at the heart of what makes Ansible so popular because they describe the tasks to be done
easily and without the need for the user to know or remember any special syntax. Not only can they declare
configurations, but they can orchestrate the steps of any manually ordered task, and can execute tasks at the
same time or at different times.
• Each playbook is composed of one or multiple plays, and the goal of a play is to map a group of hosts to well-
defined roles, represented by tasks.
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Ansible Tower
• Ansible Tower is Red Hat’s commercial web-based solution for managing Ansible.
• Its best-known feature is an easy-to-use UI for managing configurations and deployments,
• Ansible Tower contains the most important features of Ansible, especially those that are easier to see in a graphical
format rather than a text-based format.
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Practical example
Ansible
installed
EC2
Manager
EC2 node1
10.0.81.10
EC2 node2
10.0.81.11
EC2 node1
10.0.81.12
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Generate ssh key at Manager EC2
ssh-keygen
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Copy public key to remote (to node 1-2-3)
• cat ~/.ssh/id_rsa.pub |ssh -i kkey.pem ec2-user@10.0.81.10 "cat - >>
~/.ssh/authorized_keys”
• Repeat above step to all 3 nodes
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Install ansible on Manager
OR
OR in ubuntu
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Every steps here onward to be execute on Manager (ansible installed instance)
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Basic config
• Ansible by default install basic configs at /etc/ansible
• Good practice is copy that and work on copy
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Configure hostfile
• Since we have taken a copy we need to configure which host file to be used
• Update ansible.cfg as follows
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Update hosts
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Verify [ad-hoc command]
• Now we can verify that ansible can use all hosts or not
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Some more ad-hoc command
• Add-hoc commands are the command can use directly on terminal without configure
• -m à shell module
• -a à argument
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Failed – need sudo access
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
-b sudo access –K ask sudu password
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Verify user
With ansible
Without ansible
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Roles
• Ansible will execute roles on target machines
• Palybook can determine which role to which target machine
• Role is directory under roles and need other directory call task and inside main.yml
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Install a package
• nmap is not installed
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Create main.yml
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Create playbook
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
EXECUTE
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
verify
nmap installed
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Configure additional packages
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Additional packages
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Variable substitution
• Ansible can replace values with variable.
• Lets see how we can use one install option and provide packages
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Copy files
• Create sample file at /home/ec2-user/data.txt
vim roles/setup/tasks/main.yml
* http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
Execute and verify

More Related Content

What's hot

Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
rtCamp
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
Betclic Everest Group Tech Team
 
Mini-Training: Redis
Mini-Training: RedisMini-Training: Redis
Mini-Training: Redis
Betclic Everest Group Tech Team
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
Clark Everetts
 
Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016
David Brattoli
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Cliff Seal
 
ColdFusion builder plugins
ColdFusion builder pluginsColdFusion builder plugins
ColdFusion builder plugins
ColdFusionConference
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
Juraj Kiss
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
Derek Jacoby
 
Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016
David Brattoli
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
ColdFusionConference
 
Docker With Asp.net Core
Docker With Asp.net CoreDocker With Asp.net Core
Docker With Asp.net Core
Fatih Şimşek
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon
 
Building a community of Open Source intranet users
Building a community of Open Source intranet usersBuilding a community of Open Source intranet users
Building a community of Open Source intranet users
Luke Oatham
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
How to make your Webpack builds 10x faster
How to make your Webpack builds 10x fasterHow to make your Webpack builds 10x faster
How to make your Webpack builds 10x faster
trueter
 
Dev objective2015 lets git together
Dev objective2015 lets git togetherDev objective2015 lets git together
Dev objective2015 lets git together
ColdFusionConference
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
ColdFusionConference
 

What's hot (20)

Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Mini-Training: Redis
Mini-Training: RedisMini-Training: Redis
Mini-Training: Redis
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
 
ColdFusion builder plugins
ColdFusion builder pluginsColdFusion builder plugins
ColdFusion builder plugins
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 
Docker With Asp.net Core
Docker With Asp.net CoreDocker With Asp.net Core
Docker With Asp.net Core
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Building a community of Open Source intranet users
Building a community of Open Source intranet usersBuilding a community of Open Source intranet users
Building a community of Open Source intranet users
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
How to make your Webpack builds 10x faster
How to make your Webpack builds 10x fasterHow to make your Webpack builds 10x faster
How to make your Webpack builds 10x faster
 
Dev objective2015 lets git together
Dev objective2015 lets git togetherDev objective2015 lets git together
Dev objective2015 lets git together
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 

Similar to Introduction to ansible

OpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and WindowsOpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and Windows
Alessandro Pilotti
 
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Erich Beyrent
 
Introduction to Office Development Topics
Introduction to Office Development TopicsIntroduction to Office Development Topics
Introduction to Office Development Topics
Haaron Gonzalez
 
Using ansible to manage cloud stack
Using ansible to manage cloud stackUsing ansible to manage cloud stack
Using ansible to manage cloud stack
Kiran Manohar Chavala
 
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlueCloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
ShapeBlue
 
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Mandi Walls
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Michael Lihs
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.
Andrii Podanenko
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
shaikshazil1
 
Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application
Tanja REPO 🦊
 
TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
TechUG Glasgow talk 22/Feb/17 Configuration Management Best PracticesTechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
Dag Sonstebo
 
T3 - Deploy, manage, and scale your apps
T3 - Deploy, manage, and scale your appsT3 - Deploy, manage, and scale your apps
T3 - Deploy, manage, and scale your apps
Amazon Web Services
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
Tim Fairweather
 
The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.
WP Engine
 
Best practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on SalesforceBest practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on Salesforce
AIMDek Technologies
 
Cloud Foundry: Hands-on Deployment Workshop
Cloud Foundry: Hands-on Deployment WorkshopCloud Foundry: Hands-on Deployment Workshop
Cloud Foundry: Hands-on Deployment Workshop
Manuel Garcia
 
WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016
Terell Moore
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker bud
Mandi Walls
 
CIAOPS Need to Know Azure Webinar - November 2017
CIAOPS Need to Know Azure Webinar - November 2017CIAOPS Need to Know Azure Webinar - November 2017
CIAOPS Need to Know Azure Webinar - November 2017
Robert Crane
 

Similar to Introduction to ansible (20)

OpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and WindowsOpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and Windows
 
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
 
Introduction to Office Development Topics
Introduction to Office Development TopicsIntroduction to Office Development Topics
Introduction to Office Development Topics
 
Using ansible to manage cloud stack
Using ansible to manage cloud stackUsing ansible to manage cloud stack
Using ansible to manage cloud stack
 
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlueCloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
CloudStack Tooling Ecosystem – Kiran Chavala, ShapeBlue
 
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
 
Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application
 
TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
TechUG Glasgow talk 22/Feb/17 Configuration Management Best PracticesTechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
TechUG Glasgow talk 22/Feb/17 Configuration Management Best Practices
 
T3 - Deploy, manage, and scale your apps
T3 - Deploy, manage, and scale your appsT3 - Deploy, manage, and scale your apps
T3 - Deploy, manage, and scale your apps
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.
 
Best practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on SalesforceBest practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on Salesforce
 
Cloud Foundry: Hands-on Deployment Workshop
Cloud Foundry: Hands-on Deployment WorkshopCloud Foundry: Hands-on Deployment Workshop
Cloud Foundry: Hands-on Deployment Workshop
 
WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker bud
 
CIAOPS Need to Know Azure Webinar - November 2017
CIAOPS Need to Know Azure Webinar - November 2017CIAOPS Need to Know Azure Webinar - November 2017
CIAOPS Need to Know Azure Webinar - November 2017
 

Recently uploaded

May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 

Recently uploaded (20)

May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 

Introduction to ansible

  • 1. Introduction to Ansible Krishantha Dinesh Msc, MIEEE, MBCS Software Architect www.krishantha.com www.youtube.com/krish @krishantha
  • 2. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Configuration management • Manage software on top of hardware • Maintain consistency based on functionality and design • It is systems engineering process for establishing and maintaining consistency of a product's performance
  • 3. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Why Configuration Management • Make consistency • Maintain integrity • No need separate log in / execution on each server • Centralize control / management • Scaling made easy • No time to deploy or configure after successful build • Rolling back is easy
  • 4. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What is ansible • Ansible is an open-source software provisioning, configuration management, and application-deployment tool. • It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. • Its pushed based configuration management tool
  • 5. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Why ansible • Free. Ansible is an open-source tool. • Very simple to set up and use. No special coding skills are necessary to use Ansible’s playbooks • Powerful. Ansible lets you model even highly complex IT workflows. • Flexible. You can orchestrate the entire application environment no matter where it’s deployed. You can also customize it based on your needs. • Agentless. You don’t need to install any other software or firewall ports on the client systems you want to automate. You also don’t have to set up a separate management structure. • Efficient. Because you don’t need to install any extra software, there’s more room for application resources on your server.
  • 6. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Ansible Architecture • Modules • Modules are like small programs that Ansible pushes out from a control machine to all the nodes / remote hosts. • The modules are executed using playbooks. • They control things such as services, packages and files. Ansible executes all the modules for installing updates or whatever the required task is, and then removes them when finished. • Ansible provides 400+ modules for common tasks
  • 7. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ • Plugins • As many other tools and platforms, plugins are extra pieces of code that augment functionality. • Ansible comes with a number of its own plugins. • we can write your own as well.
  • 8. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ • Inventory • All the machines you’re using with Ansible (the control machine plus nodes) are listed in a single simple file, with their IP addresses, names etc. • Once you list the inventory, you can assign variables to any of the hosts using a simple text file.
  • 9. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ • Playbook • Ansible playbooks are like instruction manuals for tasks. • They are simple files written in YAML. (human-readable data serialization language). • Playbooks are really at the heart of what makes Ansible so popular because they describe the tasks to be done easily and without the need for the user to know or remember any special syntax. Not only can they declare configurations, but they can orchestrate the steps of any manually ordered task, and can execute tasks at the same time or at different times. • Each playbook is composed of one or multiple plays, and the goal of a play is to map a group of hosts to well- defined roles, represented by tasks.
  • 10. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Ansible Tower • Ansible Tower is Red Hat’s commercial web-based solution for managing Ansible. • Its best-known feature is an easy-to-use UI for managing configurations and deployments, • Ansible Tower contains the most important features of Ansible, especially those that are easier to see in a graphical format rather than a text-based format.
  • 11. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Practical example Ansible installed EC2 Manager EC2 node1 10.0.81.10 EC2 node2 10.0.81.11 EC2 node1 10.0.81.12
  • 12. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Generate ssh key at Manager EC2 ssh-keygen
  • 13. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Copy public key to remote (to node 1-2-3) • cat ~/.ssh/id_rsa.pub |ssh -i kkey.pem ec2-user@10.0.81.10 "cat - >> ~/.ssh/authorized_keys” • Repeat above step to all 3 nodes
  • 14. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Install ansible on Manager OR OR in ubuntu
  • 15. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Every steps here onward to be execute on Manager (ansible installed instance)
  • 16. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Basic config • Ansible by default install basic configs at /etc/ansible • Good practice is copy that and work on copy
  • 17. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Configure hostfile • Since we have taken a copy we need to configure which host file to be used • Update ansible.cfg as follows
  • 18. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Update hosts
  • 19. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Verify [ad-hoc command] • Now we can verify that ansible can use all hosts or not
  • 20. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Some more ad-hoc command • Add-hoc commands are the command can use directly on terminal without configure • -m à shell module • -a à argument
  • 21. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
  • 22. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Failed – need sudo access
  • 23. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ -b sudo access –K ask sudu password
  • 24. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Verify user With ansible Without ansible
  • 25. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Roles • Ansible will execute roles on target machines • Palybook can determine which role to which target machine • Role is directory under roles and need other directory call task and inside main.yml
  • 26. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Install a package • nmap is not installed
  • 27. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Create main.yml
  • 28. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Create playbook
  • 29. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ EXECUTE
  • 30. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ verify nmap installed
  • 31. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Configure additional packages
  • 32. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Additional packages
  • 33. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Variable substitution • Ansible can replace values with variable. • Lets see how we can use one install option and provide packages
  • 34. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/
  • 35. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Copy files • Create sample file at /home/ec2-user/data.txt vim roles/setup/tasks/main.yml
  • 36. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Execute and verify