SlideShare a Scribd company logo
1 of 26
Download to read offline
DevOps (3)
- Ansible —
Mulodo Vietnam Co., Ltd.
Our Purpose
Make ourselves ‘Dev Company’ from
‘factory’.
Points
Engineering knowledge <- * TODAY *
Logical Thinking
Co-operation work
— Study Group —
What’s DevOps?
Mindset of filling gap between Dev and Ops.
It’s not any technologies or solutions.
C.A.M.S
Culture
Bust silos. Don’t say “no”. Involve everyone.
Automation
XXX as Code. Ask machines to do same things.
Metrics
monitor, find failure, Improve, make a plan.
Share
Dev->Ops, Ops->Dev, share metrics.
Feedback of previous study
Feedback of previous study (2)
What’s Vagrant?
manager of Virtual Machines
Vagrant can manage …
Virtual Box
VMware (Fusion)
AWS EC2 ….
Trigger of automation engine.
Vagrant run …
Ansible
Chef
Puppet ….
Ansible
simple IT automation engine
What’s Ansible?
Ansible is a radically simple IT
automation engine that
automates cloud provisioning,
configuration management,
application deployment, intra-
service orchestration, and many
other IT needs. 

(http://www.ansible.com/)
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Today: learn Ansible
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Today: learn Ansible
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Today: learn Ansible
How Ansible work?
Hosts
[httpd]
192.168.33.40
192.168.33.41
[backend]
192.168.33.50
Playbook (YAML file)
- hosts: httpd
become: yes
tasks:
- name: be sure httpd is installed
yum: name=httpd state=installed
- name: be sure httpd is running and enabled
service: name=httpd state=started enabled=yes
target serves
tasks
Create hosts file
- Location
- Anywhere you want.
- Default: as you installed Ansible..
$ ansible --help
Usage: ansible <host-pattern> [options]
:
-i INVENTORY, --inventory-file=INVENTORY
specify inventory host file
(default=/usr/local/etc/ansible/hosts)
:
$
$ cd TEST <— Your test Vagrant location
TEST$ emacs hosts
:
TEST$ cat hosts
[test-servers]
192.168.33.10 <— IP address of Your Vagrant server
TEST$
Create playbook
- Location
- Anywhere you want. (No Default)
$ cd TEST <— Your test Vagrant location
TEST$ mkdir playbooks
TEST$ cd playbooks
TEST/playbooks$ emacs httpd.yml
:
TEST$ cat httpd.yml
- hosts: httpd-server
become: yes
tasks:
- name: be sure httpd is installed
yum: name=httpd state=installed
- name: be sure httpd is running and enabled
service: name=httpd state=started enabled=yes
TEST$
Try your playbook
1. check your network
- Anywhere you want. (No Default)
TEST$ ansible -i hosts all -m ping
192.168.33.50 | success >> {
"changed": false,
"ping": "pong"
}
TEST$ ansible -i hosts httpd-server -m ping
192.168.33.50 | success >> {
"changed": false,
"ping": "pong"
}
ssh troubles?
Any Trouble?
-> check your ssh configuration
TEST$ vagrant ssh-config
:
IdentityFile /XXXXXX/private_key
:
TEST$ ssh -i /XXXXXX/private_key vagrant@192.168.33.50
— ANY TROUBLE? —
1. remove information from .ssh/know_hosts
2. set ssh configuration to .ssh/config
Host 192.168.33.50
User vagrant
TCPKeepAlive yes
IdentityFile /XXXXXXX/private_key
IdentitiesOnly yes
ControlPersist 2h
Try your playbook (2)
2. check your playbook
TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml --syntax-check
playbook: playbooks/httpd.yml
TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml --list-tasks
playbook: playbooks/httpd.yml
play #1 (httpd-server): TAGS: []
be sure httpd is installed TAGS: []
be sure httpd is running and enabled TAGS: []
air:nemo@~/TEST_STUDY$
— set sandbox —
set sandbox to test many times
TEST$ vagrant sandbox status
[default] Sandbox mode is off
TEST$ vagrant sandbox on
[default] Starting sandbox mode...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
TEST$ vagrant sandbox status
[default] Sandbox mode is on
TEST$
Try your playbook (3)
3. do your playbook
TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml
PLAY [httpd-server] ***********************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.33.50]
TASK: [be sure httpd is installed] ********************************************
changed: [192.168.33.50]
TASK: [be sure httpd is running and enabled] **********************************
changed: [192.168.33.50]
PLAY RECAP ********************************************************************
192.168.33.50 : ok=3 changed=2 unreachable=0 failed=0
TEST$
—- inside Virtual machine —-
[vagrant@vagrant-centos65 init.d]$ ls /etc/init.d/httpd
ls: cannot access /etc/init.d/httpd: No such file or directory
[vagrant@vagrant-centos65 init.d]$
—- inside Virtual machine —-
[vagrant@vagrant-centos65 init.d]$ ls /etc/init.d/httpd
/etc/init.d/httpd
[vagrant@vagrant-centos65 init.d]$
Insider Playbook
playbook : YAML file
- hosts: httpd-server
become: yes
tasks:
- name: be sure httpd is installed
yum: name=httpd state=installed
- name: be sure httpd is running and enabled
service: name=httpd state=started enabled=yes
target servers - ‘hosts’ file
do with ‘sudo’
Task : definition
name : description
Task itself
Inside Playbook
tasks inside : Modules
yum: name=httpd state=installed
module Parameters
http://docs.ansible.com/ansible/modules.html
http://docs.ansible.com/ansible/modules_by_category.html
— rollback sandbox —
Rollback sandbox :
back to server environment before install HTTPD
TEST$ vagrant sandbox rollback
[default] Rolling back the virtual machine...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
air:nemo@~/TEST_STUDY$
Set Ansible into Vagrantfile
Vagrantfile
# -*- mode: ruby -*- 

:
# Ansible 

config.vm.provision “ansible” do |ansible|
ansible.playbook = “playbooks/httpd.yml"
ansible.inventory_path = “./hosts”
ansible.limit = “httpd-server”
end
:
end
https://docs.vagrantup.com/v2/provisioning/ansible.html
set playbook
set inventory(hosts)
set terget server
TEST$ vagrant reload —-provision
Try : do Ansbile with Vagrant
TEST$ vagrant reload --provision
==> default: Attempting graceful shutdown of VM...
:
==> default: Machine booted and ready!
:
==> default: Running provisioner: ansible...
PLAY [httpd-server] ***********************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.33.50]
TASK: [be sure httpd is installed] ********************************************
changed: [192.168.33.50]
TASK: [be sure httpd is running and enabled] **********************************
changed: [192.168.33.50]
PLAY RECAP ********************************************************************
192.168.33.50 : ok=3 changed=2 unreachable=0 failed=0
air:nemo@~/TEST_STUDY$
server has launched.
start Ansible tasks
Server setting was changed.
Task
Task
Server setting was changed.
Goal : Today’s archive
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Homework
A. Please learn ‘Modules’ of Ansible.
- Note) Use ‘Official document’
- http://docs.ansible.com/ansible/modules.html
- http://docs.ansible.com/ansible/modules_by_category.html
- There are many useful ansible modules.
B. Please learn ‘Ansible Provisioner’ of
Vagrant.
- Note) Use ‘Official document’
- https://docs.vagrantup.com/v2/provisioning/ansible.html
- There are many useful provisioner related to ansible.
Homework (2)
C. Please make playbook of PHP/MySQL.
- currently, there is only httpd playbook.
HINT
Vagrantfile
:
ansible.playbook = “playbooks/setup.yml”
:
setup.yml
=====
# setup httpd
- include: playbooks/httpd.yml
# setup mysql
- include: playbooks/mysql.yml
# setup php
- include: playbooks/php.yml
=====
Next : Ansible(2)
A) What’s Idempotence??
B) Make spec list.
and use tarballs.

More Related Content

What's hot

Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013Tomas Doran
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...Puppet
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Brian Schott
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleRoman Rodomansky
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecMartin Etmajer
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 

What's hot (20)

Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 

Viewers also liked

DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with AnsibleSwapnil Jain
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeSarah Z
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Keith Resar
 
Introduzione DevOps con Ansible
Introduzione DevOps con AnsibleIntroduzione DevOps con Ansible
Introduzione DevOps con AnsibleMatteo Magni
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 

Viewers also liked (7)

DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 
Introduzione DevOps con Ansible
Introduzione DevOps con AnsibleIntroduzione DevOps con Ansible
Introduzione DevOps con Ansible
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 

Similar to Ansible automation for PHP/MySQL/Apache setup

A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Triggerjathanism
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionSysdig
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksLindsay Holmwood
 
Web 3, Week 1: Amazon Web Services for Beginners
Web 3, Week 1: Amazon Web Services for BeginnersWeb 3, Week 1: Amazon Web Services for Beginners
Web 3, Week 1: Amazon Web Services for Beginnersjkosoy
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Modern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDModern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDSean Chittenden
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOpsAgile Spain
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Simon McCartney
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011Carlos Sanchez
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in DjangoKevin Harvey
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and ContainersRodolfo Carvalho
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellBoulos Dib
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 

Similar to Ansible automation for PHP/MySQL/Apache setup (20)

A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Trigger
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 
Web 3, Week 1: Amazon Web Services for Beginners
Web 3, Week 1: Amazon Web Services for BeginnersWeb 3, Week 1: Amazon Web Services for Beginners
Web 3, Week 1: Amazon Web Services for Beginners
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Modern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDModern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSD
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Puppet
PuppetPuppet
Puppet
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 

Recently uploaded

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 

Ansible automation for PHP/MySQL/Apache setup

  • 1. DevOps (3) - Ansible — Mulodo Vietnam Co., Ltd.
  • 2. Our Purpose Make ourselves ‘Dev Company’ from ‘factory’. Points Engineering knowledge <- * TODAY * Logical Thinking Co-operation work — Study Group —
  • 3. What’s DevOps? Mindset of filling gap between Dev and Ops. It’s not any technologies or solutions. C.A.M.S Culture Bust silos. Don’t say “no”. Involve everyone. Automation XXX as Code. Ask machines to do same things. Metrics monitor, find failure, Improve, make a plan. Share Dev->Ops, Ops->Dev, share metrics. Feedback of previous study
  • 4. Feedback of previous study (2) What’s Vagrant? manager of Virtual Machines Vagrant can manage … Virtual Box VMware (Fusion) AWS EC2 …. Trigger of automation engine. Vagrant run … Ansible Chef Puppet ….
  • 6. What’s Ansible? Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra- service orchestration, and many other IT needs. 
 (http://www.ansible.com/)
  • 10. How Ansible work? Hosts [httpd] 192.168.33.40 192.168.33.41 [backend] 192.168.33.50 Playbook (YAML file) - hosts: httpd become: yes tasks: - name: be sure httpd is installed yum: name=httpd state=installed - name: be sure httpd is running and enabled service: name=httpd state=started enabled=yes target serves tasks
  • 11. Create hosts file - Location - Anywhere you want. - Default: as you installed Ansible.. $ ansible --help Usage: ansible <host-pattern> [options] : -i INVENTORY, --inventory-file=INVENTORY specify inventory host file (default=/usr/local/etc/ansible/hosts) : $ $ cd TEST <— Your test Vagrant location TEST$ emacs hosts : TEST$ cat hosts [test-servers] 192.168.33.10 <— IP address of Your Vagrant server TEST$
  • 12. Create playbook - Location - Anywhere you want. (No Default) $ cd TEST <— Your test Vagrant location TEST$ mkdir playbooks TEST$ cd playbooks TEST/playbooks$ emacs httpd.yml : TEST$ cat httpd.yml - hosts: httpd-server become: yes tasks: - name: be sure httpd is installed yum: name=httpd state=installed - name: be sure httpd is running and enabled service: name=httpd state=started enabled=yes TEST$
  • 13. Try your playbook 1. check your network - Anywhere you want. (No Default) TEST$ ansible -i hosts all -m ping 192.168.33.50 | success >> { "changed": false, "ping": "pong" } TEST$ ansible -i hosts httpd-server -m ping 192.168.33.50 | success >> { "changed": false, "ping": "pong" }
  • 14. ssh troubles? Any Trouble? -> check your ssh configuration TEST$ vagrant ssh-config : IdentityFile /XXXXXX/private_key : TEST$ ssh -i /XXXXXX/private_key vagrant@192.168.33.50 — ANY TROUBLE? — 1. remove information from .ssh/know_hosts 2. set ssh configuration to .ssh/config Host 192.168.33.50 User vagrant TCPKeepAlive yes IdentityFile /XXXXXXX/private_key IdentitiesOnly yes ControlPersist 2h
  • 15. Try your playbook (2) 2. check your playbook TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml --syntax-check playbook: playbooks/httpd.yml TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml --list-tasks playbook: playbooks/httpd.yml play #1 (httpd-server): TAGS: [] be sure httpd is installed TAGS: [] be sure httpd is running and enabled TAGS: [] air:nemo@~/TEST_STUDY$
  • 16. — set sandbox — set sandbox to test many times TEST$ vagrant sandbox status [default] Sandbox mode is off TEST$ vagrant sandbox on [default] Starting sandbox mode... 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% TEST$ vagrant sandbox status [default] Sandbox mode is on TEST$
  • 17. Try your playbook (3) 3. do your playbook TEST$ ansible-playbook -i ./hosts playbooks/httpd.yml PLAY [httpd-server] *********************************************************** GATHERING FACTS *************************************************************** ok: [192.168.33.50] TASK: [be sure httpd is installed] ******************************************** changed: [192.168.33.50] TASK: [be sure httpd is running and enabled] ********************************** changed: [192.168.33.50] PLAY RECAP ******************************************************************** 192.168.33.50 : ok=3 changed=2 unreachable=0 failed=0 TEST$ —- inside Virtual machine —- [vagrant@vagrant-centos65 init.d]$ ls /etc/init.d/httpd ls: cannot access /etc/init.d/httpd: No such file or directory [vagrant@vagrant-centos65 init.d]$ —- inside Virtual machine —- [vagrant@vagrant-centos65 init.d]$ ls /etc/init.d/httpd /etc/init.d/httpd [vagrant@vagrant-centos65 init.d]$
  • 18. Insider Playbook playbook : YAML file - hosts: httpd-server become: yes tasks: - name: be sure httpd is installed yum: name=httpd state=installed - name: be sure httpd is running and enabled service: name=httpd state=started enabled=yes target servers - ‘hosts’ file do with ‘sudo’ Task : definition name : description Task itself
  • 19. Inside Playbook tasks inside : Modules yum: name=httpd state=installed module Parameters http://docs.ansible.com/ansible/modules.html http://docs.ansible.com/ansible/modules_by_category.html
  • 20. — rollback sandbox — Rollback sandbox : back to server environment before install HTTPD TEST$ vagrant sandbox rollback [default] Rolling back the virtual machine... 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% air:nemo@~/TEST_STUDY$
  • 21. Set Ansible into Vagrantfile Vagrantfile # -*- mode: ruby -*- 
 : # Ansible 
 config.vm.provision “ansible” do |ansible| ansible.playbook = “playbooks/httpd.yml" ansible.inventory_path = “./hosts” ansible.limit = “httpd-server” end : end https://docs.vagrantup.com/v2/provisioning/ansible.html set playbook set inventory(hosts) set terget server TEST$ vagrant reload —-provision
  • 22. Try : do Ansbile with Vagrant TEST$ vagrant reload --provision ==> default: Attempting graceful shutdown of VM... : ==> default: Machine booted and ready! : ==> default: Running provisioner: ansible... PLAY [httpd-server] *********************************************************** GATHERING FACTS *************************************************************** ok: [192.168.33.50] TASK: [be sure httpd is installed] ******************************************** changed: [192.168.33.50] TASK: [be sure httpd is running and enabled] ********************************** changed: [192.168.33.50] PLAY RECAP ******************************************************************** 192.168.33.50 : ok=3 changed=2 unreachable=0 failed=0 air:nemo@~/TEST_STUDY$ server has launched. start Ansible tasks Server setting was changed. Task Task Server setting was changed.
  • 23. Goal : Today’s archive Server Apps Apache PHP MySQL Product Apps Source Data Cron Virtual server Vagrant + ansible + fabric automation
  • 24. Homework A. Please learn ‘Modules’ of Ansible. - Note) Use ‘Official document’ - http://docs.ansible.com/ansible/modules.html - http://docs.ansible.com/ansible/modules_by_category.html - There are many useful ansible modules. B. Please learn ‘Ansible Provisioner’ of Vagrant. - Note) Use ‘Official document’ - https://docs.vagrantup.com/v2/provisioning/ansible.html - There are many useful provisioner related to ansible.
  • 25. Homework (2) C. Please make playbook of PHP/MySQL. - currently, there is only httpd playbook. HINT Vagrantfile : ansible.playbook = “playbooks/setup.yml” : setup.yml ===== # setup httpd - include: playbooks/httpd.yml # setup mysql - include: playbooks/mysql.yml # setup php - include: playbooks/php.yml =====
  • 26. Next : Ansible(2) A) What’s Idempotence?? B) Make spec list. and use tarballs.