SlideShare a Scribd company logo
1 of 26
Ansible
Quick Start Guide for Beginners
Why Ansible?
- Easy to Read (YAML)
- Easy to Use (Modules Support)
- Smooth Learning Curve
- Lower Complexity, Higher Productivity
- Agentless, NO AGENT, 100% Clean
- Written in Python (Friendly to Linux Systems)
- Supported by RedHat and Communities
Comparison
Language Agent Configuration Communication Difficulty
Ansible Python No YAML OpenSSH ★☆
Chef Ruby, Erlang Yes Ruby SSL ★★★★
Puppet Ruby Yes Puppet DSL SSL ★★★☆
SaltStack Python Yes YAML ZeroMQ ★★☆
The Basic Knowledge You Should Have
Operation System
- Debian, Ubuntu, CentOS, RedHat
- Windows / Windows Server
Scripting Languages
- Bash or Native Shell for Linux-Based System
- PowerShell or BatchScript for Windows System
How does it work?
Variables
Inventories
Playbooks
Compile
OpenSSH
or WinRM
Target ServersResources
Inventory
An INI-like configuration file for Host/Group definition
[webapp]
web1.example.com
web2.example.com
[mysql]
mysql1.example.com
mysql2.example.com
[postgres]
psql1.example.com
[mysql]
mysql1.example.com
mysql2.example.com
[postgres]
psql1.example.com
[database:children]
mysql
postgres
[database:vars]
foo=bar
Variable
Host/Group specific settings for the target defined in inventory
<top-dir>
host_vars/
- mysql1.example.com
group_vars/
- mysql
- postgres
ansible_user=ubuntu
ansible_port=2222
ansible_private_key_file=private_key
# ansible_ssh_private_key_file=private_key
Directory Layout
<top dir>
- inventory
- group_vars/
- group1
- group2
- host_vars/
- host1
- host2
- playbook/
- tasks/
- main.yml
- defaults/
- main.yml
- handlers/
- main.yml
- templates/
http://docs.ansible.com/ansible/playbooks_best_practices.html#directory-layout
Preparation
Setup Ansible on Control Node
$ add-apt-repository ppa:ansible/ansible
$ apt-get update
$ apt-get install ansible
OR
$ pip install ansible
Limitation for Control Node
Control Node is recommend to be Linux, or Windows Subsystem for Linux (WSL)
- http://docs.ansible.com/ansible/intro_windows.html#using-a-windows-control-machine
Additional Setup for Controlling Windows
To control Windows Slave with local User Account, no additional setup required
To control Windows Slave with AD Account, the easiest way is to setup Kerberos
$ apt-get install python-dev libkrb5-dev krb5-user
$ pip install pywinrm[kerberos] # include “brackets”
$ vim /etc/krb5.conf
http://docs.ansible.com/ansible/intro_windows.html#kerberos
Additional Setup for the Windows Slave Nodes
The older Windows require extra setup to meet basic requirements
1. Windows 7, 8, Windows Server 2008 R2
a. .Net Framework >= 4.0 (reboot required)
b. PowerShell >= 3.0 (reboot required)
2. Windows Remote Management (WinRM)
3. Apply Hotfix for Windows 7, 8, Windows Server 2008 R2, 2012
http://docs.ansible.com/ansible/intro_windows.html#windows-system-prep
What About Linux Slave?
Nope… there’s no prerequisites for Linux slave, except login user account… :-)
Ansible - The First Step
Configuration - ansible.cfg
https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg
[defaults]
inventory = ./inventory
log_path = ./ansible.log
forks = 5
ask_sudo_pass = True
ask_pass = True
Configuration - inventory
https://github.com/ansible/ansible/blob/devel/examples/hosts
[linux]
192.168.0.1
[windows7]
192.168.0.100
[windows2008r2]
192.168.0.101
[windows:children]
windows7
windows2008r2
Ansible Ad-hoc Mode (Linux)
$ ansible linux -m ping
$ ansible linux -m shell -a 'echo hello-world'
$ ansible linux -m stat -a 'path=/etc/passwd'
Ansible Ad-hoc Mode (Windows)
$ ansible windows -m win_ping
$ ansible windows -m win_shell -a 'echo hello-world'
$ ansible windows -m win_stat -a 'path=C:Users'
Gathering Facts
$ ansible all -m setup
$ ansible linux -m setup
$ ansible windows -m setup
$ ansible all -m setup -a 'filter=ansible_*'
$ ansible all -m setup -a 'gather_subset=network'
http://docs.ansible.com/ansible/setup_module.html
Playbook
Define the behaviour of the “role” - playbook/
- tasks/
- main.yml
- defaults/
- main.yml
- handlers/
- main.yml
- templates/
Live Demo with the Real Cases
Modules Supoprt
All Modules
- http://docs.ansible.com/ansible/modules_by_category.html
Windows Specific Modules
- http://docs.ansible.com/ansible/list_of_windows_modules.html
Ansible Galaxy - Playbooks by Community
https://galaxy.ansible.com/list#/roles
Q & A
Recommend to Read
- https://www.ansible.com/quick-start-video
- http://docs.ansible.com/ansible/playbooks_best_practices.html
- https://www.ansible.com/blog/ansible-best-practices-essentials
- http://docs.ansible.com/ansible/intro_windows.html

More Related Content

What's hot

Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with AnsibleAnas
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansiblesriram_rajan
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...Simplilearn
 
AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門kk_Ataka
 
Network Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleNetwork Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleAPNIC
 
ネットワーク自動化ツール紹介(Ansible・NAPALM編)
ネットワーク自動化ツール紹介(Ansible・NAPALM編)ネットワーク自動化ツール紹介(Ansible・NAPALM編)
ネットワーク自動化ツール紹介(Ansible・NAPALM編)akira6592
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 

What's hot (20)

Ansible
AnsibleAnsible
Ansible
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible
AnsibleAnsible
Ansible
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
 
Ansible
AnsibleAnsible
Ansible
 
AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門
 
Network Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with AnsibleNetwork Automation (NetDevOps) with Ansible
Network Automation (NetDevOps) with Ansible
 
ネットワーク自動化ツール紹介(Ansible・NAPALM編)
ネットワーク自動化ツール紹介(Ansible・NAPALM編)ネットワーク自動化ツール紹介(Ansible・NAPALM編)
ネットワーク自動化ツール紹介(Ansible・NAPALM編)
 
Ansible
AnsibleAnsible
Ansible
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Ansible
AnsibleAnsible
Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 

Similar to Ansible for beginners

Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop AutomationRui Lapa
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonMyNOG
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Richard Donkin
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsRaul Leite
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101APNIC
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment Systema3sec
 
Planning for-high-performance-web-application
Planning for-high-performance-web-applicationPlanning for-high-performance-web-application
Planning for-high-performance-web-applicationNguyễn Duy Nhân
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchJeff Geerling
 
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
 
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest
 
Power shell training
Power shell trainingPower shell training
Power shell trainingDavid Brabant
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides InfinityPP
 
Planning For High Performance Web Application
Planning For High Performance Web ApplicationPlanning For High Performance Web Application
Planning For High Performance Web ApplicationYue Tian
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingBeni Krisbiantoro
 

Similar to Ansible for beginners (20)

Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop Automation
 
Ansible & Salt - Vincent Boon
Ansible & Salt - Vincent BoonAnsible & Salt - Vincent Boon
Ansible & Salt - Vincent Boon
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment System
 
Planning for-high-performance-web-application
Planning for-high-performance-web-applicationPlanning for-high-performance-web-application
Planning for-high-performance-web-application
 
Ansible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps MatchAnsible + Drupal: A Fortuitous DevOps Match
Ansible + Drupal: A Fortuitous DevOps Match
 
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)
 
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
Ansible Devops North East - slides
Ansible Devops North East - slides Ansible Devops North East - slides
Ansible Devops North East - slides
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Planning For High Performance Web Application
Planning For High Performance Web ApplicationPlanning For High Performance Web Application
Planning For High Performance Web Application
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk Webhosting
 

Recently uploaded

James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !risocarla2016
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...marjmae69
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxaryanv1753
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@vikas rana
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxnoorehahmad
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGYpruthirajnayak525
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxCarrieButtitta
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comsaastr
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxJohnree4
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxFamilyWorshipCenterD
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.KathleenAnnCordero2
 

Recently uploaded (20)

James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptx
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptx
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptx
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
 

Ansible for beginners

  • 2. Why Ansible? - Easy to Read (YAML) - Easy to Use (Modules Support) - Smooth Learning Curve - Lower Complexity, Higher Productivity - Agentless, NO AGENT, 100% Clean - Written in Python (Friendly to Linux Systems) - Supported by RedHat and Communities
  • 3. Comparison Language Agent Configuration Communication Difficulty Ansible Python No YAML OpenSSH ★☆ Chef Ruby, Erlang Yes Ruby SSL ★★★★ Puppet Ruby Yes Puppet DSL SSL ★★★☆ SaltStack Python Yes YAML ZeroMQ ★★☆
  • 4. The Basic Knowledge You Should Have Operation System - Debian, Ubuntu, CentOS, RedHat - Windows / Windows Server Scripting Languages - Bash or Native Shell for Linux-Based System - PowerShell or BatchScript for Windows System
  • 5. How does it work? Variables Inventories Playbooks Compile OpenSSH or WinRM Target ServersResources
  • 6. Inventory An INI-like configuration file for Host/Group definition [webapp] web1.example.com web2.example.com [mysql] mysql1.example.com mysql2.example.com [postgres] psql1.example.com [mysql] mysql1.example.com mysql2.example.com [postgres] psql1.example.com [database:children] mysql postgres [database:vars] foo=bar
  • 7. Variable Host/Group specific settings for the target defined in inventory <top-dir> host_vars/ - mysql1.example.com group_vars/ - mysql - postgres ansible_user=ubuntu ansible_port=2222 ansible_private_key_file=private_key # ansible_ssh_private_key_file=private_key
  • 8. Directory Layout <top dir> - inventory - group_vars/ - group1 - group2 - host_vars/ - host1 - host2 - playbook/ - tasks/ - main.yml - defaults/ - main.yml - handlers/ - main.yml - templates/ http://docs.ansible.com/ansible/playbooks_best_practices.html#directory-layout
  • 10. Setup Ansible on Control Node $ add-apt-repository ppa:ansible/ansible $ apt-get update $ apt-get install ansible OR $ pip install ansible
  • 11. Limitation for Control Node Control Node is recommend to be Linux, or Windows Subsystem for Linux (WSL) - http://docs.ansible.com/ansible/intro_windows.html#using-a-windows-control-machine
  • 12. Additional Setup for Controlling Windows To control Windows Slave with local User Account, no additional setup required To control Windows Slave with AD Account, the easiest way is to setup Kerberos $ apt-get install python-dev libkrb5-dev krb5-user $ pip install pywinrm[kerberos] # include “brackets” $ vim /etc/krb5.conf http://docs.ansible.com/ansible/intro_windows.html#kerberos
  • 13. Additional Setup for the Windows Slave Nodes The older Windows require extra setup to meet basic requirements 1. Windows 7, 8, Windows Server 2008 R2 a. .Net Framework >= 4.0 (reboot required) b. PowerShell >= 3.0 (reboot required) 2. Windows Remote Management (WinRM) 3. Apply Hotfix for Windows 7, 8, Windows Server 2008 R2, 2012 http://docs.ansible.com/ansible/intro_windows.html#windows-system-prep
  • 14. What About Linux Slave? Nope… there’s no prerequisites for Linux slave, except login user account… :-)
  • 15. Ansible - The First Step
  • 16. Configuration - ansible.cfg https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg [defaults] inventory = ./inventory log_path = ./ansible.log forks = 5 ask_sudo_pass = True ask_pass = True
  • 18. Ansible Ad-hoc Mode (Linux) $ ansible linux -m ping $ ansible linux -m shell -a 'echo hello-world' $ ansible linux -m stat -a 'path=/etc/passwd'
  • 19. Ansible Ad-hoc Mode (Windows) $ ansible windows -m win_ping $ ansible windows -m win_shell -a 'echo hello-world' $ ansible windows -m win_stat -a 'path=C:Users'
  • 20. Gathering Facts $ ansible all -m setup $ ansible linux -m setup $ ansible windows -m setup $ ansible all -m setup -a 'filter=ansible_*' $ ansible all -m setup -a 'gather_subset=network' http://docs.ansible.com/ansible/setup_module.html
  • 21. Playbook Define the behaviour of the “role” - playbook/ - tasks/ - main.yml - defaults/ - main.yml - handlers/ - main.yml - templates/
  • 22. Live Demo with the Real Cases
  • 23. Modules Supoprt All Modules - http://docs.ansible.com/ansible/modules_by_category.html Windows Specific Modules - http://docs.ansible.com/ansible/list_of_windows_modules.html
  • 24. Ansible Galaxy - Playbooks by Community https://galaxy.ansible.com/list#/roles
  • 25. Q & A
  • 26. Recommend to Read - https://www.ansible.com/quick-start-video - http://docs.ansible.com/ansible/playbooks_best_practices.html - https://www.ansible.com/blog/ansible-best-practices-essentials - http://docs.ansible.com/ansible/intro_windows.html