SlideShare a Scribd company logo
Dynamic Inventory
Playbook
Roles
Tasks
Vars
Modules
Templates
 Ansible Vault
 Flexibility with ansible
 Demo of Spawning AWS EC2 instances
 Where we add and remove the host information very frequently then
keeping inventory always up-to-date become a little bit problematic
 In such case dynamic inventory comes into picture.
 Generally dynamic inventory written in scripts(python/shell)
 Dynamic inventory got benefits over static inventories.
 Reduce human error, as information is collected by scripts.
 Very less manual efforts for managing the inventories
 Ansible have inventory collection scripts for the below platforms
 AWS EC2 External Inventory Scripts, OpenStack, Google
 Example:
 ansible -i dynamic-inventory-ec.py -u ubuntu tag_Name_webserver1 –
m ping
Roles are ways of automatically loading certain
vars_files, tasks, and handlers based on a known file
structure.
Grouping content by roles also allows easy sharing of
roles with other users.
Using ansible-galaxy init will generate us a
standardised directory structure for our Role.
Advance discussion on Ansible - Rahul Inti
Advance discussion on Ansible - Rahul Inti
Variable enables more flexibility in playbooks and
roles
Variable can be used to loop through a set of given
values, access various information like the hostname
of a system and replace certain strings in templates
by system specific values
Ex:
Vault is a feature of ansible that allows keeping
sensitive data such as passwords or keys in encrypted
files, rather than as plaintext in your playbooks or
roles
These vault files can then be distributed or placed in
source control
To create a new encrypted data file, run the following
command
Example :
ansible-vault create foo.yml
 To edit an encrypted file in place, use the below command
 ansible-vault edit
 Should you wish to change your password on a vault-encrypted file or files,
you can do so with the rekey command
 ansible-vault rekey foo.yml foo1.yml
 If you have existing files that you wish to encrypt, use the below command
 ansible-vault encrypt command
 To run a playbook that contains vault-encrypted data files, you must pass
vault password
 ansible-playbook playbook.yml --ask-vault-pass
ansible-playbook playbook.yml --syntax-check
 Check for bad syntax
 Running a playbook in dry-run mode
ansible-playbook playbook.yml --check
 List all tasks in the playbook
ansible-playbook playbook.yml --list-tasks
 List the tags in the playbook
ansible-playbook playbook.yml --list-tags
 Skip the tags associated with specific tasks
ansible-playbook playbook.yml --skip-tags tag1,tag2
 Start the play from particular task
ansible-playbook playbook.yml --start-at-task=taskname
Advance discussion on Ansible - Rahul Inti
 Lets play with the playbooks
REQUIREMENTS :
Boto is a Python library that provides you with an
easy way to interact with and automate using various
Amazon Web Services
How to install Boto: Installing boto is very
straightforward, assuming your using an OS
with pip installed. If you do not currently have pip,
then do that first pip install boto
Python 2.5
Spawning AWS EC2 instances.
Advance discussion on Ansible - Rahul Inti
Advance discussion on Ansible - Rahul Inti

More Related Content

PPTX
Basics of Ansible - Sahil Davawala
PDF
Using Ansible for Deploying to Cloud Environments
ODP
ansible why ?
PDF
Jenkins and ansible reference
PDF
A quick intro to Ansible
PPT
Ansible presentation
PDF
Testing Ansible with Jenkins and Docker
PPTX
Ansible presentation
Basics of Ansible - Sahil Davawala
Using Ansible for Deploying to Cloud Environments
ansible why ?
Jenkins and ansible reference
A quick intro to Ansible
Ansible presentation
Testing Ansible with Jenkins and Docker
Ansible presentation

What's hot (20)

PDF
Ansible Introduction - Ansible Brno #1 - David Karban
PDF
Introducing Ansible
PDF
Introduction to ansible galaxy
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PDF
IT Automation with Ansible
PDF
Ansible - Swiss Army Knife Orchestration
PDF
Managing Your Cisco Datacenter Network with Ansible
PDF
Ansible and AWS
PDF
Ansible + WordPress - WordCamp Toronto 2016
PDF
#OktoCampus - Workshop : An introduction to Ansible
PPTX
Go Faster with Ansible (AWS meetup)
PPTX
Introduction to ansible
PDF
Infrastructure = Code
PDF
Ansible best practices
PPTX
Cyansible
PDF
Ansible testing
PDF
Continuous Testing with Molecule, Ansible, and GitHub Actions
PPTX
Ansible intro
PDF
Ansible windows cheat sheet by anil.k
PDF
Ansible Meetup Hamburg / Quickstart
Ansible Introduction - Ansible Brno #1 - David Karban
Introducing Ansible
Introduction to ansible galaxy
Ansible is the simplest way to automate. MoldCamp, 2015
IT Automation with Ansible
Ansible - Swiss Army Knife Orchestration
Managing Your Cisco Datacenter Network with Ansible
Ansible and AWS
Ansible + WordPress - WordCamp Toronto 2016
#OktoCampus - Workshop : An introduction to Ansible
Go Faster with Ansible (AWS meetup)
Introduction to ansible
Infrastructure = Code
Ansible best practices
Cyansible
Ansible testing
Continuous Testing with Molecule, Ansible, and GitHub Actions
Ansible intro
Ansible windows cheat sheet by anil.k
Ansible Meetup Hamburg / Quickstart
Ad

Similar to Advance discussion on Ansible - Rahul Inti (20)

PDF
Ansible 202
PDF
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
PDF
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
PPTX
Using ansible vault to protect your secrets
PDF
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
PDF
Configuration management I - Ansible + Packer
PDF
Configuration Management in Ansible
PPTX
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
PDF
Ansible 202 - sysarmy
PDF
Managing sensitive data with Ansible vault
PPTX
Ansible presentation of cil for education prepare
PPTX
ansible : Infrastructure automation,idempotent and more
PDF
Ansible Tutorial.pdf
PDF
Ansible - Hands on Training
PDF
Ansible automation tool with modules
PDF
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
PDF
Ansible, best practices
PPTX
playbooks.pptx
PDF
Ansible - Introduction
Ansible 202
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Using ansible vault to protect your secrets
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Configuration management I - Ansible + Packer
Configuration Management in Ansible
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
Ansible 202 - sysarmy
Managing sensitive data with Ansible vault
Ansible presentation of cil for education prepare
ansible : Infrastructure automation,idempotent and more
Ansible Tutorial.pdf
Ansible - Hands on Training
Ansible automation tool with modules
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible, best practices
playbooks.pptx
Ansible - Introduction
Ad

Recently uploaded (20)

PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Nekopoi APK 2025 free lastest update
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Download FL Studio Crack Latest version 2025 ?
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
medical staffing services at VALiNTRY
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Oracle Fusion HCM Cloud Demo for Beginners
Autodesk AutoCAD Crack Free Download 2025
Nekopoi APK 2025 free lastest update
Odoo Companies in India – Driving Business Transformation.pdf
Designing Intelligence for the Shop Floor.pdf
Download FL Studio Crack Latest version 2025 ?
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Adobe Illustrator 28.6 Crack My Vision of Vector Design
CHAPTER 2 - PM Management and IT Context
Monitoring Stack: Grafana, Loki & Promtail
Navsoft: AI-Powered Business Solutions & Custom Software Development
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
wealthsignaloriginal-com-DS-text-... (1).pdf
medical staffing services at VALiNTRY
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Why Generative AI is the Future of Content, Code & Creativity?
Internet Downloader Manager (IDM) Crack 6.42 Build 41

Advance discussion on Ansible - Rahul Inti

  • 1. Dynamic Inventory Playbook Roles Tasks Vars Modules Templates  Ansible Vault  Flexibility with ansible  Demo of Spawning AWS EC2 instances
  • 2.  Where we add and remove the host information very frequently then keeping inventory always up-to-date become a little bit problematic  In such case dynamic inventory comes into picture.  Generally dynamic inventory written in scripts(python/shell)  Dynamic inventory got benefits over static inventories.  Reduce human error, as information is collected by scripts.  Very less manual efforts for managing the inventories  Ansible have inventory collection scripts for the below platforms  AWS EC2 External Inventory Scripts, OpenStack, Google  Example:  ansible -i dynamic-inventory-ec.py -u ubuntu tag_Name_webserver1 – m ping
  • 3. Roles are ways of automatically loading certain vars_files, tasks, and handlers based on a known file structure. Grouping content by roles also allows easy sharing of roles with other users. Using ansible-galaxy init will generate us a standardised directory structure for our Role.
  • 6. Variable enables more flexibility in playbooks and roles Variable can be used to loop through a set of given values, access various information like the hostname of a system and replace certain strings in templates by system specific values Ex:
  • 7. Vault is a feature of ansible that allows keeping sensitive data such as passwords or keys in encrypted files, rather than as plaintext in your playbooks or roles These vault files can then be distributed or placed in source control To create a new encrypted data file, run the following command Example : ansible-vault create foo.yml
  • 8.  To edit an encrypted file in place, use the below command  ansible-vault edit  Should you wish to change your password on a vault-encrypted file or files, you can do so with the rekey command  ansible-vault rekey foo.yml foo1.yml  If you have existing files that you wish to encrypt, use the below command  ansible-vault encrypt command  To run a playbook that contains vault-encrypted data files, you must pass vault password  ansible-playbook playbook.yml --ask-vault-pass
  • 9. ansible-playbook playbook.yml --syntax-check  Check for bad syntax  Running a playbook in dry-run mode ansible-playbook playbook.yml --check  List all tasks in the playbook ansible-playbook playbook.yml --list-tasks  List the tags in the playbook ansible-playbook playbook.yml --list-tags  Skip the tags associated with specific tasks ansible-playbook playbook.yml --skip-tags tag1,tag2  Start the play from particular task ansible-playbook playbook.yml --start-at-task=taskname
  • 11.  Lets play with the playbooks
  • 12. REQUIREMENTS : Boto is a Python library that provides you with an easy way to interact with and automate using various Amazon Web Services How to install Boto: Installing boto is very straightforward, assuming your using an OS with pip installed. If you do not currently have pip, then do that first pip install boto Python 2.5 Spawning AWS EC2 instances.

Editor's Notes

  • #6: Note:tasks are basically yml files
  • #8: Note: I will show u how vault works in demo
  • #13: Notes: production Arch