SlideShare a Scribd company logo
1 of 20
Download to read offline
Daniel Fienberg
DevOps Engineer
danielfi@cloudzone.io
Ansible on AWS
• Open source configuration management platform written in Python
and backed by software giant RedHat
• Salt, Chef, Puppet are other CM platforms
• Scripting on a high level
• Designed to be centralized, lightweight, scalable, fast, easy to
install and use
• Used for any task that you need to do more than once
• Playbooks (Ansible scripts) written in YAML
• No agent required on target hosts
What is Ansible?
How Ansible is Different
from Other CM Platforms
Ansible Other CM Platforms
(Chef, Puppet, Salt)
SSH (22)
Control
Node
Remote Hosts
CM Agent
Control
Node
• Ansible performs tasks on hosts and calls modules to
perform them
• Ansible runs through its tasks on a set of hosts in parallel
• Modules provide wrappers for tasks
• Tasks make changes only if necessary
• Core set of modules for common SysAdmin tasks
(package maintenance, filesystem maintenance etc.)
• Modules for shell commands and scripts
How does Ansible Work?
• Many cloud modules come built-in
• Can be run as a local action and perform the action from your
laptop
• Covers most common cloud tasks.

ec2 - create, terminate, start or stop an instance in ec2

ec2_ami - create or destroy an image in ec2

ec2_ami_search - Retrieve AWS AMI information for a given operating system.

ec2_asg - Create or delete AWS Autoscaling Groups

ec2_eip - associate an EC2 elastic IP with an instance.

ec2_elb - De-registers or registers instances from EC2 ELBs

ec2_facts - Gathers facts about remote hosts within ec2 (aws)

ec2_group - maintain an ec2 VPC security group.

ec2_key - maintain an ec2 key pair.

ec2_vol - create and attach a volume, return volume id and device map

… and many more)
AWS Cloud Modules
How Cloud Modules Work
Regular Module
Python Script Sent over SSH
e.g. Install Apache
AWS Cloud Module
Control Node
Control Node
Amazon API
Boto
Provision AWS Service e.g. Add EBS
Remote Host
Local
Action
Remote Host
• Ansible needs to know where to run commands
• This information is found in an inventory file
• It can be static and manually maintained

localhost ansible_connection=local <——-> Host

[webservers] <——-> Group

10.10.10.10 ansible_user=ec2-user ansible_ssh_private_key_file=~/.ssh/aws.pem

10.10.10.20

[dbservers]

one.example.com
• You can include many extra details in inventory file - tags,
SSH keys, aliases, login user etc.
Inventory File
• Inventory file that is generated automatically at runtime by
a script
• Ansible knows to run the inventory file as a script because
of executable permissions on the file
• Useful for cloud environments because hosts and their
addresses change often
• Script makes API calls to cloud provider and uses
information to generate inventory file
• Scripts for AWS, OpenStack etc on Ansible Github repo
Dynamic Inventory
• Defines each host as a JSON object
• Public or private IP used as host identifier (ec2.ini)
• Groups hosts according to many filters (instance
type, tags, security groups, AZs)
• EC2 instance details can be referenced at runtime
(e.g. tags, instance type, private key name etc.)
AWS Dynamic Inventory
• Extremely powerful Ansible module (setup) that is
optionally run at the beginning of a Playbook
• Gathers LOTS of information about the host that can
be accessed by Playbook at runtime
• Variables defined by facts can be referenced at run
time by the Playbook
• Useful for provisioning systems based on conditions
(OS, kernel, volumes, network interfaces etc.)
Get Facts
• Ansible can either be run as an ad-hoc command
or as script called a Playbook (YAML format)
• Ad-hoc command is for one time command on
many servers
• Ad-hoc Command Usage:

# ansible <host-pattern> -m <module> -
a <arguments> -i inventory [options]
Ad-hoc Command
• Ansible ping

# ansible all -m ping -i static
• Ansible facts

# ansible tag_Name_dev -m setup -i ec2.py --private-key
=~/.ssh/private_key.pem -u ec2-user
• EC2 facts

# ansible tag_Name_dev -m ec2_facts -i ec2.py -u ec2-user —
private-key=“{{ ec2_key_name }}.pem”
• Install apache

# ansible webservers -m yum -a "name=httpd state=present” -i
static
Ad-hoc Command Examples
• The real power of Ansible are Playbooks
• Easily readable set of tasks to perform
• Include files for easy grouping of tasks
• Only perform tasks on based on instance specific info
(AWS instance tags, AWS instance type, OS type, etc.)
• Playbook Command Usage:

# ansible-playbook playbook.yml -i
inventory [options]
Playbooks
• Comprehensive documentation on Ansible website
• Example playbooks on Ansible Github repo
• Ansible Galaxy - community repo of Playbooks
(galaxy.ansible.com)
• Ansible Tower - Commercial visual dashboard
Getting Started
• Released at beginning of 2016
• Introduced code blocks
• Try-catch statements
• Extended support for Windows (winrm)
• Many more cloud modules
Ansible 2.0
1. Provision instances in AWS environment
2. Apply AWS configurations (Security Groups etc.)
3. Install LAMP services
4. Copy custom configuration files, set services to on
etc.
Provision LAMP Stack
• There isn’t time to do things manually if you want to
remain profitable
• Tasks that you thought were not easy to automate
often are
• Ansible does not make mistakes - people do!
• Can prepare environment for Ansible with a
wrapper script
Tip 1: Be Lazy
• All configuration done with SSH
• All key locations are passed as a dynamically
generated path
• Boto credentials are set as environment variables
with a wrapper script
• No sensitive data ever included in playbook -
customer specific data stored at a separate
location
Tip 2: Be Secure
• Write playbooks that can run on many OSs
• Automatically detect login user name
• Use templates, dynamic inventory variables and
Ansible facts
• Dynamically locate customer specific variables
Tip 3: Be Dynamic
Thank you!
By the way, we’re hiring:

Cloud engineers and DevOps

contact@cloudzone.io

More Related Content

What's hot

Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Simplilearn
 

What's hot (20)

How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
 
Using Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public CloudUsing Ansible at Scale to Manage a Public Cloud
Using Ansible at Scale to Manage a Public Cloud
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraForm
 
Monitor-Driven Development Using Ansible
Monitor-Driven Development Using AnsibleMonitor-Driven Development Using Ansible
Monitor-Driven Development Using Ansible
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EAT
 
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
 
No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
 
Ansible
AnsibleAnsible
Ansible
 
Network automation (NetDevOps) with Ansible
Network automation (NetDevOps) with AnsibleNetwork automation (NetDevOps) with Ansible
Network automation (NetDevOps) with Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Ansible Case Studies
Ansible Case StudiesAnsible Case Studies
Ansible Case Studies
 
Getting Started with Amazon ECS
Getting Started with Amazon ECSGetting Started with Amazon ECS
Getting Started with Amazon ECS
 
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.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.
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Basics of Ansible - Sahil Davawala
Basics of Ansible - Sahil DavawalaBasics of Ansible - Sahil Davawala
Basics of Ansible - Sahil Davawala
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
 
Fake IT, until you make IT
Fake IT, until you make ITFake IT, until you make IT
Fake IT, until you make IT
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
 

Viewers also liked

Scaling by Design: AWS Web Services Patterns
Scaling by Design:AWS Web Services PatternsScaling by Design:AWS Web Services Patterns
Scaling by Design: AWS Web Services Patterns
Amazon Web Services
 

Viewers also liked (20)

Deploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with AnsibleDeploying On-Prem as SaaS: Why we go with Ansible
Deploying On-Prem as SaaS: Why we go with Ansible
 
Introduction to Automated Deployments with Ansible
Introduction to Automated Deployments with AnsibleIntroduction to Automated Deployments with Ansible
Introduction to Automated Deployments with Ansible
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Scaling by Design: AWS Web Services Patterns
Scaling by Design:AWS Web Services PatternsScaling by Design:AWS Web Services Patterns
Scaling by Design: AWS Web Services Patterns
 
Agile BI - Pop-up Loft Tel Aviv
Agile BI - Pop-up Loft Tel AvivAgile BI - Pop-up Loft Tel Aviv
Agile BI - Pop-up Loft Tel Aviv
 
Data Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and ArchiveData Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and Archive
 
Hybrid Infrastructure Integration
Hybrid Infrastructure IntegrationHybrid Infrastructure Integration
Hybrid Infrastructure Integration
 
Get the Most Out of Amazon EC2: A Deep Dive on Reserved, On-Demand, and Spot ...
Get the Most Out of Amazon EC2: A Deep Dive on Reserved, On-Demand, and Spot ...Get the Most Out of Amazon EC2: A Deep Dive on Reserved, On-Demand, and Spot ...
Get the Most Out of Amazon EC2: A Deep Dive on Reserved, On-Demand, and Spot ...
 
Encryption and Key Management in AWS
Encryption and Key Management in AWSEncryption and Key Management in AWS
Encryption and Key Management in AWS
 
AWS March 2016 Webinar Series Getting Started with Serverless Architectures
AWS March 2016 Webinar Series   Getting Started with Serverless ArchitecturesAWS March 2016 Webinar Series   Getting Started with Serverless Architectures
AWS March 2016 Webinar Series Getting Started with Serverless Architectures
 
AWS APAC Webinar Week - Understanding AWS Storage Options
AWS APAC Webinar Week - Understanding AWS Storage OptionsAWS APAC Webinar Week - Understanding AWS Storage Options
AWS APAC Webinar Week - Understanding AWS Storage Options
 
The Pace of Innovation - Pop-up Loft Tel Aviv
The Pace of Innovation - Pop-up Loft Tel AvivThe Pace of Innovation - Pop-up Loft Tel Aviv
The Pace of Innovation - Pop-up Loft Tel Aviv
 
Deep Dive: Hybrid Architectures
Deep Dive: Hybrid ArchitecturesDeep Dive: Hybrid Architectures
Deep Dive: Hybrid Architectures
 
AWS Mobile Services & SDK Introduction & Demo
AWS Mobile Services & SDK Introduction & DemoAWS Mobile Services & SDK Introduction & Demo
AWS Mobile Services & SDK Introduction & Demo
 
(NET307) Pinterest: The road from EC2-Classic To EC2-VPC
(NET307) Pinterest: The road from EC2-Classic To EC2-VPC(NET307) Pinterest: The road from EC2-Classic To EC2-VPC
(NET307) Pinterest: The road from EC2-Classic To EC2-VPC
 
Workshop: AWS Lamda Signal Corps vs Zombies
Workshop: AWS Lamda Signal Corps vs ZombiesWorkshop: AWS Lamda Signal Corps vs Zombies
Workshop: AWS Lamda Signal Corps vs Zombies
 
Compute Without Servers – Building Applications with AWS Lambda - Technical 301
Compute Without Servers – Building Applications with AWS Lambda - Technical 301Compute Without Servers – Building Applications with AWS Lambda - Technical 301
Compute Without Servers – Building Applications with AWS Lambda - Technical 301
 
(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++
 
Security Day IAM Recommended Practices
Security Day IAM Recommended PracticesSecurity Day IAM Recommended Practices
Security Day IAM Recommended Practices
 
My First Big Data Application
My First Big Data ApplicationMy First Big Data Application
My First Big Data Application
 

Similar to Ansible on aws - Pop-up Loft Tel Aviv

Similar to Ansible on aws - Pop-up Loft Tel Aviv (20)

Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
RTP NPUG: Ansible Intro and Integration with ACI
RTP NPUG: Ansible Intro and Integration with ACIRTP NPUG: Ansible Intro and Integration with ACI
RTP NPUG: Ansible Intro and Integration with ACI
 
Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Ansible get started
Ansible get startedAnsible get started
Ansible get started
 
Ansible a tool for dev ops
Ansible a tool for dev opsAnsible a tool for dev ops
Ansible a tool for dev ops
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016Ansible + Amazon AWS talk installfest.cz 2016
Ansible + Amazon AWS talk installfest.cz 2016
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Hyperledger Cello Feb 20, 2018
Hyperledger Cello Feb 20, 2018Hyperledger Cello Feb 20, 2018
Hyperledger Cello Feb 20, 2018
 
Network automation ansible_nx-api
Network automation ansible_nx-apiNetwork automation ansible_nx-api
Network automation ansible_nx-api
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Containers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshell
 
PowerPoint Presentation
PowerPoint PresentationPowerPoint Presentation
PowerPoint Presentation
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
Let's Get Acquainted: Ansible! / Symfony Camp UA 2014
Let's Get Acquainted: Ansible!  / Symfony Camp UA 2014Let's Get Acquainted: Ansible!  / Symfony Camp UA 2014
Let's Get Acquainted: Ansible! / Symfony Camp UA 2014
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
Ansible101
Ansible101Ansible101
Ansible101
 

More from Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
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)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Ansible on aws - Pop-up Loft Tel Aviv

  • 2. • Open source configuration management platform written in Python and backed by software giant RedHat • Salt, Chef, Puppet are other CM platforms • Scripting on a high level • Designed to be centralized, lightweight, scalable, fast, easy to install and use • Used for any task that you need to do more than once • Playbooks (Ansible scripts) written in YAML • No agent required on target hosts What is Ansible?
  • 3. How Ansible is Different from Other CM Platforms Ansible Other CM Platforms (Chef, Puppet, Salt) SSH (22) Control Node Remote Hosts CM Agent Control Node
  • 4. • Ansible performs tasks on hosts and calls modules to perform them • Ansible runs through its tasks on a set of hosts in parallel • Modules provide wrappers for tasks • Tasks make changes only if necessary • Core set of modules for common SysAdmin tasks (package maintenance, filesystem maintenance etc.) • Modules for shell commands and scripts How does Ansible Work?
  • 5. • Many cloud modules come built-in • Can be run as a local action and perform the action from your laptop • Covers most common cloud tasks.
 ec2 - create, terminate, start or stop an instance in ec2
 ec2_ami - create or destroy an image in ec2
 ec2_ami_search - Retrieve AWS AMI information for a given operating system.
 ec2_asg - Create or delete AWS Autoscaling Groups
 ec2_eip - associate an EC2 elastic IP with an instance.
 ec2_elb - De-registers or registers instances from EC2 ELBs
 ec2_facts - Gathers facts about remote hosts within ec2 (aws)
 ec2_group - maintain an ec2 VPC security group.
 ec2_key - maintain an ec2 key pair.
 ec2_vol - create and attach a volume, return volume id and device map
 … and many more) AWS Cloud Modules
  • 6. How Cloud Modules Work Regular Module Python Script Sent over SSH e.g. Install Apache AWS Cloud Module Control Node Control Node Amazon API Boto Provision AWS Service e.g. Add EBS Remote Host Local Action Remote Host
  • 7. • Ansible needs to know where to run commands • This information is found in an inventory file • It can be static and manually maintained
 localhost ansible_connection=local <——-> Host
 [webservers] <——-> Group
 10.10.10.10 ansible_user=ec2-user ansible_ssh_private_key_file=~/.ssh/aws.pem
 10.10.10.20
 [dbservers]
 one.example.com • You can include many extra details in inventory file - tags, SSH keys, aliases, login user etc. Inventory File
  • 8. • Inventory file that is generated automatically at runtime by a script • Ansible knows to run the inventory file as a script because of executable permissions on the file • Useful for cloud environments because hosts and their addresses change often • Script makes API calls to cloud provider and uses information to generate inventory file • Scripts for AWS, OpenStack etc on Ansible Github repo Dynamic Inventory
  • 9. • Defines each host as a JSON object • Public or private IP used as host identifier (ec2.ini) • Groups hosts according to many filters (instance type, tags, security groups, AZs) • EC2 instance details can be referenced at runtime (e.g. tags, instance type, private key name etc.) AWS Dynamic Inventory
  • 10. • Extremely powerful Ansible module (setup) that is optionally run at the beginning of a Playbook • Gathers LOTS of information about the host that can be accessed by Playbook at runtime • Variables defined by facts can be referenced at run time by the Playbook • Useful for provisioning systems based on conditions (OS, kernel, volumes, network interfaces etc.) Get Facts
  • 11. • Ansible can either be run as an ad-hoc command or as script called a Playbook (YAML format) • Ad-hoc command is for one time command on many servers • Ad-hoc Command Usage:
 # ansible <host-pattern> -m <module> - a <arguments> -i inventory [options] Ad-hoc Command
  • 12. • Ansible ping
 # ansible all -m ping -i static • Ansible facts
 # ansible tag_Name_dev -m setup -i ec2.py --private-key =~/.ssh/private_key.pem -u ec2-user • EC2 facts
 # ansible tag_Name_dev -m ec2_facts -i ec2.py -u ec2-user — private-key=“{{ ec2_key_name }}.pem” • Install apache
 # ansible webservers -m yum -a "name=httpd state=present” -i static Ad-hoc Command Examples
  • 13. • The real power of Ansible are Playbooks • Easily readable set of tasks to perform • Include files for easy grouping of tasks • Only perform tasks on based on instance specific info (AWS instance tags, AWS instance type, OS type, etc.) • Playbook Command Usage:
 # ansible-playbook playbook.yml -i inventory [options] Playbooks
  • 14. • Comprehensive documentation on Ansible website • Example playbooks on Ansible Github repo • Ansible Galaxy - community repo of Playbooks (galaxy.ansible.com) • Ansible Tower - Commercial visual dashboard Getting Started
  • 15. • Released at beginning of 2016 • Introduced code blocks • Try-catch statements • Extended support for Windows (winrm) • Many more cloud modules Ansible 2.0
  • 16. 1. Provision instances in AWS environment 2. Apply AWS configurations (Security Groups etc.) 3. Install LAMP services 4. Copy custom configuration files, set services to on etc. Provision LAMP Stack
  • 17. • There isn’t time to do things manually if you want to remain profitable • Tasks that you thought were not easy to automate often are • Ansible does not make mistakes - people do! • Can prepare environment for Ansible with a wrapper script Tip 1: Be Lazy
  • 18. • All configuration done with SSH • All key locations are passed as a dynamically generated path • Boto credentials are set as environment variables with a wrapper script • No sensitive data ever included in playbook - customer specific data stored at a separate location Tip 2: Be Secure
  • 19. • Write playbooks that can run on many OSs • Automatically detect login user name • Use templates, dynamic inventory variables and Ansible facts • Dynamically locate customer specific variables Tip 3: Be Dynamic
  • 20. Thank you! By the way, we’re hiring:
 Cloud engineers and DevOps
 contact@cloudzone.io