SlideShare a Scribd company logo
Ansible
DevOps for people who hate DevOps
Jude Ashan | Senior System Engineer | Tiqri Corporation (Pvt) Ltd.
State of Ops
I know, I’ll write code
to tell the computer
how to set up itself!
What is Ansible
● A configuration management tool.
● Deployment tool.
● Ad-hoc task execution tool.
● Developed by Michael DeHaan.
● Userbase includes NASA, Apple, Juniper
All-in-one tool
Why Ansible over other competitive tools
● Easy
○ Uses SSH (with one python requirement).
○ Agent-less.
○ Can install Ansible with one command.
○ Syntax do not need to be memorized.
○ Push-Based.
● Simple
○ No development knowledge required.
○ Human readable.
○ Built-in Modules.
Ansible consists with
● Inventory
● Ad Hoc Commands
● Playbooks
○ Tasks
○ Variables
○ Templates
○ Handlers
○ Roles
● Modules (inbuilt & custom)
● Plugins (emails, logging, etc.)
Ansible Architecture
● Inventory - /etc/ansible/hosts file (for static inventory).
● Sample -
[col_dev_db_master]
192.168.133.53
[col_dev_micro_bo]
192.168.133.42
192.168.132.189
192.168.133.52
* Dynamic inventory is managed using tags provided by server farm vendor.
Ansible Inventory (hosts file)
Ad Hoc Commands - Why?
● To make sys admin’s life easy to manage high no. of servers.
● Will be used to check
○ Check log files
○ Check resource usage
○ Manage system users and groups
○ Check for patches and apply updates using package managers
○ Deploy applications
○ Manage cron jobs
○ Reboot servers.
$ ansible all -m ping
$ ansible all -a "hostname"
$ ansible all -a 'df -h'
$ ansible all -b -m yum -a 'name=ntp state=present'
$ ansible col_dev_db_master -b -m yum -a "name=mariadb-server state=present"
$ ansible all -b -m user -a "name=devopsadmin group=admin createhome=yes"
$ ansible col_dev_micro_bo -m copy -a "src=test.txt dest=/tmp/"
$ ansible col_dev_micro_bo -m file -a "dest=/tmp/test.txt state=absent"
Ad Hoc Commands - How?
About Playbooks
● Powerful configuration management tool.
● Playbook is a file written in YAML syntax.
● Any number of plays can be run in a playbook. Each play has a task.
Let’s get our hands dirty with
Ansible Playbooks
- hosts: col_dev_micro_bo
become: yes
become_method: sudo
remote_user: root
tasks:
- name: Install Apache Web Server
yum:
name: httpd
state: present
- name: Enable and start Apache Web Server
service:
name: httpd
state: started
enabled: yes
Lab1 - Install Apache and Enable it on server startup
File name -
/etc/ansible/apache.yml
Command to run playbook -
$ ansible-playbook apache.yml
An example to learn tasks usage.
- hosts: col_dev_micro_bo
become: yes
become_method: sudo
remote_user: root
vars:
var_name1: abc
var_name2: xyz
tasks:
- name: Create Directory Structure
file:
path: “{{ item }}”
state: directory
owner: testuser
group: testuser
mode: "0775"
with_items:
- /colombo/red
- /colombo/blue
- /colombo/red/circle
- /colombo/red/square
- "/sydney/opera/{{ var_name1 }}"
- "/sydney/opera/{{ var_name1
}}/triangle"
- "/sydney/opera/{{ var_name2 }}"
- "/sydney/opera/{{ var_name2
}}/triangle"
Lab2 - Create
Directories
File name -
/etc/ansible/directory.yml
Command to run playbook -
$ ansible-playbook directory.yml
An example to learn variables and
loops usage.
- hosts: col_dev_micro_bo
vars:
listen_port: 82
serveradmin: its@tiqri.com
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum:
name: httpd
state: latest
- name: write the apache config file
template:
src: /srv/httpd.j2
dest: /etc/httpd.conf
notify:
- restart apache
- name: ensure apache is running
service:
name: httpd
state: started
handlers:
- name: restart apache
service:
name: httpd
state: restarted
Lab3 - Configure Apache
virtual host
File name -
/etc/ansible/apache.yml
Command to run playbook -
$ ansible-playbook apache.yml
An example to learn templates and
handlers usages.
Ansible Roles
● What it does?
○ Provides a framework for fully independent, or interdependent collections of variables, tasks,
files, templates, and modules.
○ Breaks “Playbooks” into multiple files.
● Why we need roles?
○ It simplifies writing complex playbooks.
○ It makes them easier to reuse.
Ansible Roles
Folder structure as below
/etc/ansibles/hosts
/etc/ansibles/app_servers.yml
/etc/ansibles/db_servers.yml
/etc/ansibles/roles/apache/
|_ /files/mod_jk.so
|_ /handlers/main.yml
|_ /tasks/main.yml
|_ /templates/default_vhost.j2
|_ /vars/main.yml
/etc/ansibles/roles/postgres/
|_ /files/table_reindex.sql
|_ /handlers/main.yml
|_ /tasks/main.yml
|_ /templates/pg_hba.conf
|_ /vars/main.yml
Ansible Roles
How Ansible Roles call by a Playbook?
- hosts: col_dev_db_master
become: yes
become_method: sudo
remote_user: root
roles:
- role: init
- role: postgres
Lab4 - How Ansible Roles call by a Playbook?
File name -
/etc/ansible/app_servers.yml
Command to run playbook -
$ ansible-playbook testplaybook.yml
An example to learn roles usage in a
playbook.
Session
Highlights
● Playbook - to run tasks and roles.
● Roles - to run tasks in more organized and simplest way.
● Handlers - restart to restart services.
● Templates - to push configuration files with respective variables.
● Vars - to define variables.
● Must follow YAML syntax.
● Key authentication should be issued for Ansible master-client communication.
● Complete documentation - https://docs.ansible.com/
We are done
THANK YOU
Any Questions?

More Related Content

What's hot

More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
bcoca
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
bcoca
 
Drupal from scratch
Drupal from scratchDrupal from scratch
Drupal from scratch
Rovic Honrado
 
Ansible with-junos
Ansible with-junosAnsible with-junos
Ansible with-junos
Akhmad Zaimi
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
Simon McCartney
 
Babushka
BabushkaBabushka
Babushka
Richard McGain
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
iman darabi
 
Start using vagrant now!
Start using vagrant now!Start using vagrant now!
Start using vagrant now!
Andrii Podanenko
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
Frederik Engelen
 
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Digicomp Academy AG
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
Ivan Serdyuk
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
Greg DeKoenigsberg
 
Automating with ansible (Part B)
Automating with ansible (Part B)Automating with ansible (Part B)
Automating with ansible (Part B)
iman darabi
 
Automating WordPress Theme Development
Automating WordPress Theme DevelopmentAutomating WordPress Theme Development
Automating WordPress Theme Development
Hardeep Asrani
 
Ansible 202
Ansible 202Ansible 202
Ansible 202
Sebastian Montini
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for us
sickill
 
Zram
ZramZram
Django Multi-DB in Anger
Django Multi-DB in AngerDjango Multi-DB in Anger
Django Multi-DB in Anger
Loren Davie
 
Dbbarang
DbbarangDbbarang

What's hot (19)

More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Drupal from scratch
Drupal from scratchDrupal from scratch
Drupal from scratch
 
Ansible with-junos
Ansible with-junosAnsible with-junos
Ansible with-junos
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
Babushka
BabushkaBabushka
Babushka
 
Automating with ansible (part a)
Automating with ansible (part a)Automating with ansible (part a)
Automating with ansible (part a)
 
Start using vagrant now!
Start using vagrant now!Start using vagrant now!
Start using vagrant now!
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
 
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 
Automating with ansible (Part B)
Automating with ansible (Part B)Automating with ansible (Part B)
Automating with ansible (Part B)
 
Automating WordPress Theme Development
Automating WordPress Theme DevelopmentAutomating WordPress Theme Development
Automating WordPress Theme Development
 
Ansible 202
Ansible 202Ansible 202
Ansible 202
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for us
 
Zram
ZramZram
Zram
 
Django Multi-DB in Anger
Django Multi-DB in AngerDjango Multi-DB in Anger
Django Multi-DB in Anger
 
Dbbarang
DbbarangDbbarang
Dbbarang
 

Similar to Introduction to Ansible - (dev ops for people who hate devops)

Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Omid Vahdaty
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
Cédric Delgehier
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
iman darabi
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
Jeff Geerling
 
Ansible intro
Ansible introAnsible intro
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
Artefactual Systems - AtoM
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
Łukasz Proszek
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
DonghuKIM2
 
Introduction to Ansible - Peter Halligan
Introduction to Ansible - Peter HalliganIntroduction to Ansible - Peter Halligan
Introduction to Ansible - Peter Halligan
CorkOpenTech
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
Chu-Siang Lai
 
Ansible_Basics_ppt.pdf
Ansible_Basics_ppt.pdfAnsible_Basics_ppt.pdf
Ansible_Basics_ppt.pdf
PrabhjotSingh976002
 
Getting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfGetting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdf
ssuserd254491
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
George Shuklin
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
Osama Mustafa
 
Ansible
AnsibleAnsible
Ansible
Rahul Bajaj
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
NigussMehari4
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
Mehmet Ali Aydın
 
Ansible
AnsibleAnsible
Ansible
Afroz Hussain
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
ahamilton55
 

Similar to Introduction to Ansible - (dev ops for people who hate devops) (20)

Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Introduction to Ansible - Peter Halligan
Introduction to Ansible - Peter HalliganIntroduction to Ansible - Peter Halligan
Introduction to Ansible - Peter Halligan
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
 
Ansible_Basics_ppt.pdf
Ansible_Basics_ppt.pdfAnsible_Basics_ppt.pdf
Ansible_Basics_ppt.pdf
 
Getting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdfGetting Started with Ansible - Jake.pdf
Getting Started with Ansible - Jake.pdf
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Ansible
AnsibleAnsible
Ansible
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible
AnsibleAnsible
Ansible
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 

Recently uploaded

HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 

Recently uploaded (20)

HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 

Introduction to Ansible - (dev ops for people who hate devops)

  • 1. Ansible DevOps for people who hate DevOps Jude Ashan | Senior System Engineer | Tiqri Corporation (Pvt) Ltd.
  • 3. I know, I’ll write code to tell the computer how to set up itself!
  • 4. What is Ansible ● A configuration management tool. ● Deployment tool. ● Ad-hoc task execution tool. ● Developed by Michael DeHaan. ● Userbase includes NASA, Apple, Juniper All-in-one tool
  • 5. Why Ansible over other competitive tools ● Easy ○ Uses SSH (with one python requirement). ○ Agent-less. ○ Can install Ansible with one command. ○ Syntax do not need to be memorized. ○ Push-Based. ● Simple ○ No development knowledge required. ○ Human readable. ○ Built-in Modules.
  • 6. Ansible consists with ● Inventory ● Ad Hoc Commands ● Playbooks ○ Tasks ○ Variables ○ Templates ○ Handlers ○ Roles ● Modules (inbuilt & custom) ● Plugins (emails, logging, etc.)
  • 8. ● Inventory - /etc/ansible/hosts file (for static inventory). ● Sample - [col_dev_db_master] 192.168.133.53 [col_dev_micro_bo] 192.168.133.42 192.168.132.189 192.168.133.52 * Dynamic inventory is managed using tags provided by server farm vendor. Ansible Inventory (hosts file)
  • 9. Ad Hoc Commands - Why? ● To make sys admin’s life easy to manage high no. of servers. ● Will be used to check ○ Check log files ○ Check resource usage ○ Manage system users and groups ○ Check for patches and apply updates using package managers ○ Deploy applications ○ Manage cron jobs ○ Reboot servers.
  • 10. $ ansible all -m ping $ ansible all -a "hostname" $ ansible all -a 'df -h' $ ansible all -b -m yum -a 'name=ntp state=present' $ ansible col_dev_db_master -b -m yum -a "name=mariadb-server state=present" $ ansible all -b -m user -a "name=devopsadmin group=admin createhome=yes" $ ansible col_dev_micro_bo -m copy -a "src=test.txt dest=/tmp/" $ ansible col_dev_micro_bo -m file -a "dest=/tmp/test.txt state=absent" Ad Hoc Commands - How?
  • 11. About Playbooks ● Powerful configuration management tool. ● Playbook is a file written in YAML syntax. ● Any number of plays can be run in a playbook. Each play has a task.
  • 12. Let’s get our hands dirty with Ansible Playbooks
  • 13. - hosts: col_dev_micro_bo become: yes become_method: sudo remote_user: root tasks: - name: Install Apache Web Server yum: name: httpd state: present - name: Enable and start Apache Web Server service: name: httpd state: started enabled: yes Lab1 - Install Apache and Enable it on server startup File name - /etc/ansible/apache.yml Command to run playbook - $ ansible-playbook apache.yml An example to learn tasks usage.
  • 14. - hosts: col_dev_micro_bo become: yes become_method: sudo remote_user: root vars: var_name1: abc var_name2: xyz tasks: - name: Create Directory Structure file: path: “{{ item }}” state: directory owner: testuser group: testuser mode: "0775" with_items: - /colombo/red - /colombo/blue - /colombo/red/circle - /colombo/red/square - "/sydney/opera/{{ var_name1 }}" - "/sydney/opera/{{ var_name1 }}/triangle" - "/sydney/opera/{{ var_name2 }}" - "/sydney/opera/{{ var_name2 }}/triangle" Lab2 - Create Directories File name - /etc/ansible/directory.yml Command to run playbook - $ ansible-playbook directory.yml An example to learn variables and loops usage.
  • 15. - hosts: col_dev_micro_bo vars: listen_port: 82 serveradmin: its@tiqri.com remote_user: root tasks: - name: ensure apache is at the latest version yum: name: httpd state: latest - name: write the apache config file template: src: /srv/httpd.j2 dest: /etc/httpd.conf notify: - restart apache - name: ensure apache is running service: name: httpd state: started handlers: - name: restart apache service: name: httpd state: restarted Lab3 - Configure Apache virtual host File name - /etc/ansible/apache.yml Command to run playbook - $ ansible-playbook apache.yml An example to learn templates and handlers usages.
  • 16. Ansible Roles ● What it does? ○ Provides a framework for fully independent, or interdependent collections of variables, tasks, files, templates, and modules. ○ Breaks “Playbooks” into multiple files. ● Why we need roles? ○ It simplifies writing complex playbooks. ○ It makes them easier to reuse.
  • 17. Ansible Roles Folder structure as below /etc/ansibles/hosts /etc/ansibles/app_servers.yml /etc/ansibles/db_servers.yml /etc/ansibles/roles/apache/ |_ /files/mod_jk.so |_ /handlers/main.yml |_ /tasks/main.yml |_ /templates/default_vhost.j2 |_ /vars/main.yml /etc/ansibles/roles/postgres/ |_ /files/table_reindex.sql |_ /handlers/main.yml |_ /tasks/main.yml |_ /templates/pg_hba.conf |_ /vars/main.yml
  • 18. Ansible Roles How Ansible Roles call by a Playbook?
  • 19. - hosts: col_dev_db_master become: yes become_method: sudo remote_user: root roles: - role: init - role: postgres Lab4 - How Ansible Roles call by a Playbook? File name - /etc/ansible/app_servers.yml Command to run playbook - $ ansible-playbook testplaybook.yml An example to learn roles usage in a playbook.
  • 21. ● Playbook - to run tasks and roles. ● Roles - to run tasks in more organized and simplest way. ● Handlers - restart to restart services. ● Templates - to push configuration files with respective variables. ● Vars - to define variables. ● Must follow YAML syntax. ● Key authentication should be issued for Ansible master-client communication. ● Complete documentation - https://docs.ansible.com/
  • 22. We are done THANK YOU Any Questions?

Editor's Notes

  1. Ask the audience what they think about this. NOT about - people who hate devops. It’s about - How to reduce the complexity of devops
  2. Show audience a sample server installation checklist - C:\D\Rezg Stuff\Network\Documents\Portals\Common\Linux Installation\Check List.xls (this will take 3 working days to complete a server configurations and qa)