SlideShare a Scribd company logo
DevOps (4)
- Ansible (2) —
Soshi Nemoto
Mulodo Vietnam Co., Ltd.
Our Purpose
Make ourselves ‘Business partner’ 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 ….
Feedback of previous study (3)
What’s ansible?
A radically simple IT automation engine
for ‘infrastructure as Code’…
“Ask machines to do SAME things”
Trial
Simple usage (hosts and playbook)
Set in Vagrantfile
Ansible (2)
A radically simple IT automation engine
What’s Idempotence?
How to install version
specified application
AGENDA
What’s Idempotence?
The property that can be applied
multiple times without changing
the result beyond the initial
application. (wikipedia)
Ansible is idempotence !?
What’s Idempotence?
The property that can be applied
multiple times without changing
the result beyond the initial
application. (wikipedia)
Ansible is idempotence !?
Ansible playbook should be idempotence.
Why do you learn Ansible here?
DevOps -> Automation (C.A.M.S.)
Why do you learn Ansible here?
DevOps -> Automation (C.A.M.S.)
Automation
Infrastructure as Code.
Clarify specification.
- playbook
Guarantee same result.
- Idempotence
Why do you learn Ansible here?
DevOps -> Automation (C.A.M.S.)
Automation
Infrastructure as Code.
Clarify specification.
- playbook
Guarantee same result.
- Idempotence
Why do you learn Ansible here?
DevOps -> Automation (C.A.M.S.)
Automation
Infrastructure as Code.
Clarify specification.
- playbook
Guarantee same result.
- Idempotence
You need to check results carefully for each
operation, if it is not guaranteed to get same
result when you do it repeatedly.
Idempotence
Love
it
!
What’s Idempotence?
How to install version
specified application
How to build ‘tarball’?
How to create playbooks?
AGENDA
Application
Server applications is NOT gifts
from Buddha.
Server application is NOT
packages of YUM/Apt/RPM.
Almost server apps are
only C/C++ applications.
You can install Apps without Package manager.
How to make C/C++ apps?
#include "stdio.h"
int main(int argc, char *argv[])
{
printf("Hello, world!n");
return 0;
}
hello.c
$ gcc -o hello hello.c
$ ls
hello* hello.c
$ ./hello
Hello, world!
$
compile
execute
More complex C++ apps
Shared libraries (*.so files)
Objects which are built from
only classes/functions.
Header files (*.h)
Definition I/F of classes, functions…
+
Shared object file (*.so)
Built binary of classes, functions…
How to link to .so file?
application
Static link
include libs inside
the application
application
Dynamic link
Use libraries directly
from the application.
While compiling, header files are used to get
I/F of classes/functions of libraries.
Complex applications
PHP
Ex. php
…
It used many libs.
libxml2.so libkrb5.so
$ ldd `which php` | wc -l
43
$
In my case, 43 libs
are used.
$ otool -L `which php` (on OSX)
PHP
Ex. php
…
You need to check every libs(headers) are
exists for each extensions.
libxml2.so libkrb5.so
In my case, 43 libs
are used.
Too Heavy !!
$ ldd `which php` | wc -l
43
$
$ otool -L `which php` (on OSX)
It used many libs.
Complex applications
More complex C++ apps (4)
Make
Configure
Great task runner. Love it.
(BSD) make, GNU make (gmake)
$ make
$ make install
Check environment of the system.
- checking libs and its versions.
- create Makefile for your option.
GNU Autotools
Tools to create configure scripts for your
applications. It’s too troublesome to
create ‘configure’ by yourself.
Okay, I’m ready to start

(Go fast..)
Preparation (fix spec)
PHP
Version : 5.4.44
Modules
DSO style.
prefix : /usr/local
gd : disable
intl : enable
pear : /usr/local/lib/php
pdo : enable
mysql : enable
mbstring : enabled
mbregex : enable
Preparation (for Vagrant)
$ vagrant sandbox status
[default] Sandbox mode is on
$ 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%
$ vagrant sandbox status
[default] Sandbox mode is on
$
check ‘sandbox mode is ON’
Rollback your vagrant machine to
pure vagrant, if you’ve already
modified it.
Preparation (httpd, mysqld)
To test PHP build,
Install MySQL, httpd(apache2) by
package manager.
[vagrant@vagrant-centos65 ~]$ sudo yum install mysql
mysql-server httpd httpd-devel
Login: Vagrant machine
$ vagrant ssh
Last login: Thu Dec 10 01:57:16 2015 from 10.0.2.2
[vagrant@vagrant-centos65 ~]$
Build (get php tarball)
[vagrant@vagrant-centos65 ~]$ mkdir tmp
[vagrant@vagrant-centos65 ~]$ cd tmp
[vagrant@vagrant-centos65 tmp]$ sudo yum install wget
Loaded plugins: fastestmirror, versionlock
Determining fastest mirrors
epel/metalink | 4.9 kB 00:00
:
Installed size: 1.8 M
Is this ok [y/N]: y
:
Complete!
[vagrant@vagrant-centos65 tmp]$ wget http://sg2.php.net/
distributions/php-5.4.44.tar.gz
[vagrant@vagrant-centos65 tmp]$ ls -al php-5.4.44.tar.gz
-rw-rw-r-- 1 vagrant vagrant 15878182 Aug 6 23:00
php-5.4.44.tar.gz
[vagrant@vagrant-centos65 tmp]$
get tarball
Build (unarchive)
[vagrant@vagrant-centos65 tmp]$ gzip -d php-5.4.44.tar.gz
[vagrant@vagrant-centos65 tmp]$ ls -al php-5.4.44.tar*
-rw-rw-r-- 1 vagrant vagrant 107755008 Aug 6 23:00 php-5.4.44.tar
[vagrant@vagrant-centos65 tmp]$ tar xvf php-5.4.44.tar
php-5.4.44/
php-5.4.44/.gdbinit
php-5.4.44/.gitattributes
:
php-5.4.44/build/scan_makefile_in.awk
php-5.4.44/build/shtool
[vagrant@vagrant-centos65 tmp]$
Unarchive (please learn gzip/tar)
or
[vagrant@vagrant-centos65 tmp]$ tar zxvf php-5.4.44.tar.gz
php-5.4.44/
php-5.4.44/.gdbinit
php-5.4.44/.gitattributes
:
php-5.4.44/build/scan_makefile_in.awk
php-5.4.44/build/shtool
[vagrant@vagrant-centos65 tmp]$
Build (check configure options)
[vagrant@vagrant-centos65 php-5.4.44]$ ./configure --help > conf.list
[vagrant@vagrant-centos65 php-5.4.44]$ less conf.list
Get option list
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
:
:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
:
:
PEAR:
--with-pear=DIR Install PEAR in DIR [PREFIX/lib/php]
--without-pear Do not install PEAR
:
:
CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
Build (configure options)
configure options
$configure 
--with-apxs2 
--prefix=/usr/local 
--with-mysql 
--enable-intl 
--with-pear=/usr/local/lib/php 
--enable-mbstring 
--enable-mbregex 2>&1 | tee 00congif.log
$configure 
--with-apxs2 
--with-mysql 
--enable-intl 
--enable-mbstring 
--enable-mbregex 2>&1 | tee 00config.log
Build (configure-1 )
[vagrant@vagrant-centos65 php-5.4.44]$ ./configure --with-apxs2 --
with-mysql --enable-intl --enable-mbstring --enable-mbregex 2>&1 |
tee 00config.log
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
:
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2
installation.
[vagrant@vagrant-centos65 php-5.4.44]$
You need “libxml2”.
Try configure with your option
[vagrant@vagrant-centos65 tmp]$ sudo yum install libxml2 libxml2-devel
Loaded plugins: fastestmirror, versionlock
:
Total download size: 8.6 M
Is this ok [y/N]: y
Downloading Packages:
:
Complete!
[vagrant@vagrant-centos65 tmp]$
Build (configure-2 )
Search “libxml2” in yum packages.
[vagrant@vagrant-centos65 tmp]$ sudo yum search libxml2
Loaded plugins: fastestmirror, versionlock
:
libxml2.x86_64 : Library providing XML and HTML support
libxml2.i686 : Library providing XML and HTML support
libxml2-devel.i686 : Libraries, includes, etc. to develop XML and HTML applications
libxml2-devel.x86_64 : Libraries, includes, etc. to develop XML and HTML applications
:
Name and summary matches only, use "search all" for everything.
[vagrant@vagrant-centos65 tmp]$
Install the lib and devel packages.
Build (configure-2 )
Try repeatedly until success.
[vagrant@vagrant-centos65 php-5.4.44]$ ./configure --with-apxs2 --
with-mysql --enable-intl --enable-mbstring --enable-mbregex 2>&1 |
tee 00config.log
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
:
Thank you for using PHP.
config.status: creating php5.spec
:
config.status: executing default commands
[vagrant@vagrant-centos65 php-5.4.44]$
libxml2
libxml2-devel
icu
libicu-devel
Required packages
Build (make )
Compile and link.
[vagrant@vagrant-centos65 php-5.4.44]$ make 2>&1 | tee 01make.log
/bin/sh /home/vagrant/tmp/php-5.4.44/libtool --silent --preserve-dup-
deps --mode=compile cc -Iext/date/lib -Iext/date/ -I/home/vagrant/tmp/
php-5.....
:
:
:
:
:
:
:
:
:
Build complete.
Don't forget to run 'make test'.
[vagrant@vagrant-centos65 php-5.4.44]$
It takes minutes.
Have a break.
Build (make install )
Install binaries and libraries.
[vagrant@vagrant-centos65 php-5.4.44]$ sudo make install 2>&1 | tee 02install.log
Installing PHP SAPI module: apache2handler
:
libtool: install: cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
:
Installing PHP CLI binary: /usr/local/bin/
:
Installing PDO headers: /usr/local/include/php/ext/pdo/
[vagrant@vagrant-centos65 php-5.4.44]$
check
[vagrant@vagrant-centos65 php-5.4.44]$ ls -al /usr/lib64/httpd/modules/libphp5.so
-rwxr-xr-x 1 root root 253886 Dec 10 06:16 /usr/lib64/httpd/modules/libphp5.so
[vagrant@vagrant-centos65 php-5.4.44]$ php -v
PHP 5.4.44 (cli) (built: Dec 10 2015 06:03:36)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
[vagrant@vagrant-centos65 php-5.4.44]$
Note) please do ‘make test’ before install.
Now You know...
1. Required applications (packages)
- mysql, mysql-server
- httpd, httpd-devel
2. Required libraries (packages)
- libxml2, libxml2-devel
- icu, libicu-devel
3. Commands to install PHP.
What’s Idempotence?
How to install version
specified application
How to build ‘tarball’?
How to create playbooks?
AGENDA
Rollback
$ 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%
$ vagrant sandbox status
[default] Sandbox mode is on
$
Your vagrant is rollbacked.
- no httpd, mysqld, httpd.
structure
setup.yml
httpd.yml
mysqld.yml
php.yml
include
include
include
hosts
Vagrantfile
:
:
# Ansible
config.vm.provision "ansible" do |ansible|
ansible.playbook = "./setup.yml"
ansible.inventory_path = "./hosts"
ansible.limit = "httpd-server"
end

:
:
./Vagrantfile
‘./setup.yml’, ‘./hosts’ will be loaded.
Create playbooks (preparation-1)
# setup httpd
- include: playbooks/httpd.yml
# setup mysql
- include: playbooks/mysqld.yml
# setup php
- include: playbooks/php.yml
./setup.yml
[httpd-server]
192.168.33.50
./hosts
IP address of your Vagrant machine
Create playbooks (preparation-2)
httpd.yml - hosts: httpd-server
become: yes
tasks:
- name: install httpd yum packages
yum: name={{ item }} state=latest
with_items:
- httpd
- httpd-devel
- name: be sure httpd is running and enabled
service: name=httpd state=started enabled=yes
mysqld.yml - hosts: httpd-server
become: yes
tasks:
- name: install mysql yum packages
yum: name={{ item }} state=latest
with_items:
- mysql
- mysql-server
- name: be sure httpd is running and enabled
service: name=mysqld state=started enabled=yes
Create playbooks (php)
1. install related packages
2. create work directory
3. get a tarball
4. unarchive tarball
5. configure source
6. make source
7. make install source
A
B
D
C
step by step !
Create playbooks (php :A)
- hosts: httpd-server
vars:
src_url: 'http://sg2.php.net/distributions/php-5.4.44.tar.gz'
src_file: 'php-5.4.44.tar.gz'
src_dir: '/home/vagrant/src'
build_dir: '/home/vagrant/src/php-5.4.44'
tasks:
- name: "PHP:install related packages"
become: yes
yum: name=wget state=latest
yum: name={{ item }} state=latest
with_items:
- wget
- libxml2
- libxml2-devel
- icu
- libicu-devel
- name: "PHP:make build dir"
file: dest={{src_dir}} state=directory
$ vagrant provision
Create playbooks (php :B)
:
:
- name: "PHP:check local source"
command: ls -l {{src_dir}}/{{src_file}}
register: src_exist
ignore_errors: True
- name: "PHP:wget the php source"
get_url: url={{src_url}} dest={{src_dir}}
when: src_exist|failed
$ vagrant provision
Create playbooks (php :C)
- hosts: httpd-server
vars:
:
php_dso_file: '/usr/lib64/httpd/modules/libphp5.so'
:
tasks:
:
- name: "PHP:check DSO"
command: ls -l {{php_dso_file}}
register: dso_exist
ignore_errors: True
- name: "PHP:unarchive source"
command: chdir={{src_dir}} tar zxvf {{src_file}}
when: dso_exist|failed
$ vagrant provision
Create playbooks (php :D)
- hosts: httpd-server
vars:
:
configure_opt: '--with-apxs2 --with-mysql --enable-intl --enable-
mbstring --enable-mbregex'
:
tasks:
:
- name: "PHP:configure"
command: chdir={{build_dir}} ./configure {{configure_opt}}
when: dso_exist|failed
- name: "PHP:make"
command: chdir={{build_dir}} make
when: dso_exist|failed
- name: “PHP:make install"
become: yes
command: chdir={{build_dir}} make install
when: dso_exist|failed
$ vagrant provision
:
PLAY RECAP ********************************************************************
192.168.33.50 : ok=15 changed=6 unreachable=0 failed=0
$
You Got It !
success
Homework
B. put your own ‘php.ini’, ‘httpd.conf’ by
Ansible playbook.
- Note) Use ‘copy’ or ‘template’ modules.
- http://docs.ansible.com/ansible/copy_module.html
- http://docs.ansible.com/ansible/template_module.html
A. Learn UNIX(SystemV) commands.
- ldconfig
- ldd (on OSX, ‘otools -L’)
C. Restart httpd after php installation

More Related Content

What's hot

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
Martin Etmajer
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
Łukasz Proszek
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
Ivan Serdyuk
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
bcoca
 
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
Carlos Sanchez
 
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
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
Dan Vaida
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
George Shuklin
 
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
Carlos Sanchez
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
Larry Cai
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
bcoca
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
Tim Riley
 
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
Lorin Hochstein
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
Murali Boyapati
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
Stephane Manciot
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Omid Vahdaty
 
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
Brian Schott
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
Rodolfo Carvalho
 

What's hot (20)

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
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
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
 
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.
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
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
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
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
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
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
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 

Similar to DevOps(4) : Ansible(2) - (MOSG)

Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Fabrice Bernhard
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
Lingvokot
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Habeeb Rahman
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
Dave Pitts
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
miguel dominguez
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
MortazaJohari
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
niyof97
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
Saeed Hajizade
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
Achieve Internet
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
Halil Kaya
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
Henryk Konsek
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet
 

Similar to DevOps(4) : Ansible(2) - (MOSG) (20)

Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Intro django
Intro djangoIntro django
Intro django
 
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil CholewińskiPilot Tech Talk #10 — Practical automation by Kamil Cholewiński
Pilot Tech Talk #10 — Practical automation by Kamil Cholewiński
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
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
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
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
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

DevOps(4) : Ansible(2) - (MOSG)

  • 1. DevOps (4) - Ansible (2) — Soshi Nemoto Mulodo Vietnam Co., Ltd.
  • 2. Our Purpose Make ourselves ‘Business partner’ 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 ….
  • 5. Feedback of previous study (3) What’s ansible? A radically simple IT automation engine for ‘infrastructure as Code’… “Ask machines to do SAME things” Trial Simple usage (hosts and playbook) Set in Vagrantfile
  • 6. Ansible (2) A radically simple IT automation engine
  • 7. What’s Idempotence? How to install version specified application AGENDA
  • 8. What’s Idempotence? The property that can be applied multiple times without changing the result beyond the initial application. (wikipedia) Ansible is idempotence !?
  • 9. What’s Idempotence? The property that can be applied multiple times without changing the result beyond the initial application. (wikipedia) Ansible is idempotence !? Ansible playbook should be idempotence.
  • 10. Why do you learn Ansible here? DevOps -> Automation (C.A.M.S.)
  • 11. Why do you learn Ansible here? DevOps -> Automation (C.A.M.S.) Automation Infrastructure as Code. Clarify specification. - playbook Guarantee same result. - Idempotence
  • 12. Why do you learn Ansible here? DevOps -> Automation (C.A.M.S.) Automation Infrastructure as Code. Clarify specification. - playbook Guarantee same result. - Idempotence
  • 13. Why do you learn Ansible here? DevOps -> Automation (C.A.M.S.) Automation Infrastructure as Code. Clarify specification. - playbook Guarantee same result. - Idempotence You need to check results carefully for each operation, if it is not guaranteed to get same result when you do it repeatedly.
  • 15. What’s Idempotence? How to install version specified application How to build ‘tarball’? How to create playbooks? AGENDA
  • 16. Application Server applications is NOT gifts from Buddha. Server application is NOT packages of YUM/Apt/RPM. Almost server apps are only C/C++ applications. You can install Apps without Package manager.
  • 17. How to make C/C++ apps? #include "stdio.h" int main(int argc, char *argv[]) { printf("Hello, world!n"); return 0; } hello.c $ gcc -o hello hello.c $ ls hello* hello.c $ ./hello Hello, world! $ compile execute
  • 18. More complex C++ apps Shared libraries (*.so files) Objects which are built from only classes/functions. Header files (*.h) Definition I/F of classes, functions… + Shared object file (*.so) Built binary of classes, functions…
  • 19. How to link to .so file? application Static link include libs inside the application application Dynamic link Use libraries directly from the application. While compiling, header files are used to get I/F of classes/functions of libraries.
  • 20. Complex applications PHP Ex. php … It used many libs. libxml2.so libkrb5.so $ ldd `which php` | wc -l 43 $ In my case, 43 libs are used. $ otool -L `which php` (on OSX)
  • 21. PHP Ex. php … You need to check every libs(headers) are exists for each extensions. libxml2.so libkrb5.so In my case, 43 libs are used. Too Heavy !! $ ldd `which php` | wc -l 43 $ $ otool -L `which php` (on OSX) It used many libs. Complex applications
  • 22. More complex C++ apps (4) Make Configure Great task runner. Love it. (BSD) make, GNU make (gmake) $ make $ make install Check environment of the system. - checking libs and its versions. - create Makefile for your option. GNU Autotools Tools to create configure scripts for your applications. It’s too troublesome to create ‘configure’ by yourself.
  • 23. Okay, I’m ready to start
 (Go fast..)
  • 24. Preparation (fix spec) PHP Version : 5.4.44 Modules DSO style. prefix : /usr/local gd : disable intl : enable pear : /usr/local/lib/php pdo : enable mysql : enable mbstring : enabled mbregex : enable
  • 25. Preparation (for Vagrant) $ vagrant sandbox status [default] Sandbox mode is on $ 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% $ vagrant sandbox status [default] Sandbox mode is on $ check ‘sandbox mode is ON’ Rollback your vagrant machine to pure vagrant, if you’ve already modified it.
  • 26. Preparation (httpd, mysqld) To test PHP build, Install MySQL, httpd(apache2) by package manager. [vagrant@vagrant-centos65 ~]$ sudo yum install mysql mysql-server httpd httpd-devel Login: Vagrant machine $ vagrant ssh Last login: Thu Dec 10 01:57:16 2015 from 10.0.2.2 [vagrant@vagrant-centos65 ~]$
  • 27. Build (get php tarball) [vagrant@vagrant-centos65 ~]$ mkdir tmp [vagrant@vagrant-centos65 ~]$ cd tmp [vagrant@vagrant-centos65 tmp]$ sudo yum install wget Loaded plugins: fastestmirror, versionlock Determining fastest mirrors epel/metalink | 4.9 kB 00:00 : Installed size: 1.8 M Is this ok [y/N]: y : Complete! [vagrant@vagrant-centos65 tmp]$ wget http://sg2.php.net/ distributions/php-5.4.44.tar.gz [vagrant@vagrant-centos65 tmp]$ ls -al php-5.4.44.tar.gz -rw-rw-r-- 1 vagrant vagrant 15878182 Aug 6 23:00 php-5.4.44.tar.gz [vagrant@vagrant-centos65 tmp]$ get tarball
  • 28. Build (unarchive) [vagrant@vagrant-centos65 tmp]$ gzip -d php-5.4.44.tar.gz [vagrant@vagrant-centos65 tmp]$ ls -al php-5.4.44.tar* -rw-rw-r-- 1 vagrant vagrant 107755008 Aug 6 23:00 php-5.4.44.tar [vagrant@vagrant-centos65 tmp]$ tar xvf php-5.4.44.tar php-5.4.44/ php-5.4.44/.gdbinit php-5.4.44/.gitattributes : php-5.4.44/build/scan_makefile_in.awk php-5.4.44/build/shtool [vagrant@vagrant-centos65 tmp]$ Unarchive (please learn gzip/tar) or [vagrant@vagrant-centos65 tmp]$ tar zxvf php-5.4.44.tar.gz php-5.4.44/ php-5.4.44/.gdbinit php-5.4.44/.gitattributes : php-5.4.44/build/scan_makefile_in.awk php-5.4.44/build/shtool [vagrant@vagrant-centos65 tmp]$
  • 29. Build (check configure options) [vagrant@vagrant-centos65 php-5.4.44]$ ./configure --help > conf.list [vagrant@vagrant-centos65 php-5.4.44]$ less conf.list Get option list `configure' configures this package to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... : : --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] : : PEAR: --with-pear=DIR Install PEAR in DIR [PREFIX/lib/php] --without-pear Do not install PEAR : : CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider.
  • 30. Build (configure options) configure options $configure --with-apxs2 --prefix=/usr/local --with-mysql --enable-intl --with-pear=/usr/local/lib/php --enable-mbstring --enable-mbregex 2>&1 | tee 00congif.log $configure --with-apxs2 --with-mysql --enable-intl --enable-mbstring --enable-mbregex 2>&1 | tee 00config.log
  • 31. Build (configure-1 ) [vagrant@vagrant-centos65 php-5.4.44]$ ./configure --with-apxs2 -- with-mysql --enable-intl --enable-mbstring --enable-mbregex 2>&1 | tee 00config.log checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E : checking libxml2 install dir... no checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. [vagrant@vagrant-centos65 php-5.4.44]$ You need “libxml2”. Try configure with your option
  • 32. [vagrant@vagrant-centos65 tmp]$ sudo yum install libxml2 libxml2-devel Loaded plugins: fastestmirror, versionlock : Total download size: 8.6 M Is this ok [y/N]: y Downloading Packages: : Complete! [vagrant@vagrant-centos65 tmp]$ Build (configure-2 ) Search “libxml2” in yum packages. [vagrant@vagrant-centos65 tmp]$ sudo yum search libxml2 Loaded plugins: fastestmirror, versionlock : libxml2.x86_64 : Library providing XML and HTML support libxml2.i686 : Library providing XML and HTML support libxml2-devel.i686 : Libraries, includes, etc. to develop XML and HTML applications libxml2-devel.x86_64 : Libraries, includes, etc. to develop XML and HTML applications : Name and summary matches only, use "search all" for everything. [vagrant@vagrant-centos65 tmp]$ Install the lib and devel packages.
  • 33. Build (configure-2 ) Try repeatedly until success. [vagrant@vagrant-centos65 php-5.4.44]$ ./configure --with-apxs2 -- with-mysql --enable-intl --enable-mbstring --enable-mbregex 2>&1 | tee 00config.log checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E : Thank you for using PHP. config.status: creating php5.spec : config.status: executing default commands [vagrant@vagrant-centos65 php-5.4.44]$ libxml2 libxml2-devel icu libicu-devel Required packages
  • 34. Build (make ) Compile and link. [vagrant@vagrant-centos65 php-5.4.44]$ make 2>&1 | tee 01make.log /bin/sh /home/vagrant/tmp/php-5.4.44/libtool --silent --preserve-dup- deps --mode=compile cc -Iext/date/lib -Iext/date/ -I/home/vagrant/tmp/ php-5..... : : : : : : : : : Build complete. Don't forget to run 'make test'. [vagrant@vagrant-centos65 php-5.4.44]$ It takes minutes. Have a break.
  • 35. Build (make install ) Install binaries and libraries. [vagrant@vagrant-centos65 php-5.4.44]$ sudo make install 2>&1 | tee 02install.log Installing PHP SAPI module: apache2handler : libtool: install: cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so : Installing PHP CLI binary: /usr/local/bin/ : Installing PDO headers: /usr/local/include/php/ext/pdo/ [vagrant@vagrant-centos65 php-5.4.44]$ check [vagrant@vagrant-centos65 php-5.4.44]$ ls -al /usr/lib64/httpd/modules/libphp5.so -rwxr-xr-x 1 root root 253886 Dec 10 06:16 /usr/lib64/httpd/modules/libphp5.so [vagrant@vagrant-centos65 php-5.4.44]$ php -v PHP 5.4.44 (cli) (built: Dec 10 2015 06:03:36) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies [vagrant@vagrant-centos65 php-5.4.44]$ Note) please do ‘make test’ before install.
  • 36. Now You know... 1. Required applications (packages) - mysql, mysql-server - httpd, httpd-devel 2. Required libraries (packages) - libxml2, libxml2-devel - icu, libicu-devel 3. Commands to install PHP.
  • 37. What’s Idempotence? How to install version specified application How to build ‘tarball’? How to create playbooks? AGENDA
  • 38. Rollback $ 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% $ vagrant sandbox status [default] Sandbox mode is on $ Your vagrant is rollbacked. - no httpd, mysqld, httpd.
  • 40. Vagrantfile : : # Ansible config.vm.provision "ansible" do |ansible| ansible.playbook = "./setup.yml" ansible.inventory_path = "./hosts" ansible.limit = "httpd-server" end
 : : ./Vagrantfile ‘./setup.yml’, ‘./hosts’ will be loaded.
  • 41. Create playbooks (preparation-1) # setup httpd - include: playbooks/httpd.yml # setup mysql - include: playbooks/mysqld.yml # setup php - include: playbooks/php.yml ./setup.yml [httpd-server] 192.168.33.50 ./hosts IP address of your Vagrant machine
  • 42. Create playbooks (preparation-2) httpd.yml - hosts: httpd-server become: yes tasks: - name: install httpd yum packages yum: name={{ item }} state=latest with_items: - httpd - httpd-devel - name: be sure httpd is running and enabled service: name=httpd state=started enabled=yes mysqld.yml - hosts: httpd-server become: yes tasks: - name: install mysql yum packages yum: name={{ item }} state=latest with_items: - mysql - mysql-server - name: be sure httpd is running and enabled service: name=mysqld state=started enabled=yes
  • 43. Create playbooks (php) 1. install related packages 2. create work directory 3. get a tarball 4. unarchive tarball 5. configure source 6. make source 7. make install source A B D C step by step !
  • 44. Create playbooks (php :A) - hosts: httpd-server vars: src_url: 'http://sg2.php.net/distributions/php-5.4.44.tar.gz' src_file: 'php-5.4.44.tar.gz' src_dir: '/home/vagrant/src' build_dir: '/home/vagrant/src/php-5.4.44' tasks: - name: "PHP:install related packages" become: yes yum: name=wget state=latest yum: name={{ item }} state=latest with_items: - wget - libxml2 - libxml2-devel - icu - libicu-devel - name: "PHP:make build dir" file: dest={{src_dir}} state=directory $ vagrant provision
  • 45. Create playbooks (php :B) : : - name: "PHP:check local source" command: ls -l {{src_dir}}/{{src_file}} register: src_exist ignore_errors: True - name: "PHP:wget the php source" get_url: url={{src_url}} dest={{src_dir}} when: src_exist|failed $ vagrant provision
  • 46. Create playbooks (php :C) - hosts: httpd-server vars: : php_dso_file: '/usr/lib64/httpd/modules/libphp5.so' : tasks: : - name: "PHP:check DSO" command: ls -l {{php_dso_file}} register: dso_exist ignore_errors: True - name: "PHP:unarchive source" command: chdir={{src_dir}} tar zxvf {{src_file}} when: dso_exist|failed $ vagrant provision
  • 47. Create playbooks (php :D) - hosts: httpd-server vars: : configure_opt: '--with-apxs2 --with-mysql --enable-intl --enable- mbstring --enable-mbregex' : tasks: : - name: "PHP:configure" command: chdir={{build_dir}} ./configure {{configure_opt}} when: dso_exist|failed - name: "PHP:make" command: chdir={{build_dir}} make when: dso_exist|failed - name: “PHP:make install" become: yes command: chdir={{build_dir}} make install when: dso_exist|failed $ vagrant provision
  • 48. : PLAY RECAP ******************************************************************** 192.168.33.50 : ok=15 changed=6 unreachable=0 failed=0 $ You Got It ! success
  • 49. Homework B. put your own ‘php.ini’, ‘httpd.conf’ by Ansible playbook. - Note) Use ‘copy’ or ‘template’ modules. - http://docs.ansible.com/ansible/copy_module.html - http://docs.ansible.com/ansible/template_module.html A. Learn UNIX(SystemV) commands. - ldconfig - ldd (on OSX, ‘otools -L’) C. Restart httpd after php installation