SlideShare a Scribd company logo
1 of 29
Download to read offline
Dynamic inventory:
No more host list!
#ansibleja Ansible勉強会#1
2014/06/10
@tagomoris
14年6月10日火曜日
TAGOMORI Satoshi (@tagomoris)
LINE Corp.
14年6月10日火曜日
Ansible
Batch server operations
add routing table entry
deploy ssh keys
update openssl
Install/update middleware
Hadoop, Presto, Fluentd (and its config/code ...)
14年6月10日火曜日
Ansible: good points
Minimal managed node requirements
Simple tool chain and files
YAML
and many built-in modules
Less stress of shell scripts
Dynamic inventory
14年6月10日火曜日
Ansible: bad points
Less japanese case-studies
Less japanese books and blog entries
Less japanese users? -> No!
14年6月10日火曜日
Inventory
Hosts and groups
Host variables / Group variables
Group of groups
‘group_vars/’ and ‘host_vars/’
14年6月10日火曜日
Inventory: example
mail01.local globalip=192.168.0.11
[blog]
www[01:30].blog.local virtualip=203.0.113.63
app[01:50].blog.local
master01.db.blog.local server_id=....
slave0[1:4].blog.local server_id=..????
[linenantoka]
www[01:10].nantoka.line.local
14年6月10日火曜日
ROLEs and TYPEs
Roles (web, app, db, hadoop, ...)
Groups (service-names, ...)
OSs, Server models, Disk types (HDD, SSD, ioDrive, ...)
IP addrs (local, global, virtual)
... and many more
14年6月10日火曜日
Yabitz
Our host management tool/server:
WebUI and WebAPI (json)
hostname[s], status, service, CPU, memory, disk,
rack position, size, local/global/virtual IPs, virtual/
parent server, ....
tags
changes(history, diff)
anything
links to other internal web tools
14年6月10日火曜日
Dynamic inventory
Dynamic inventory plugins
Cobbler external inventory script
Example for linux install server
AWS EC2 external inventory script
Digital Ocean, Google Compute Engine, Linode,
Zabbix, ...
Mix inventories (static and dynamic)
14年6月10日火曜日
Custom dynamic inventory
Original scripts AS dynamic inventory
“Developing Dynamic Inventory Sources”
http://docs.ansible.com/developing_inventory.html
executable program
implement `--list`
implement `--host HOSTNAME`
14年6月10日火曜日
JSON: for `--list`
Dynamic inventory: output
{
"databases": {
"hosts": [ "host1.local", "host2.local" ],
"vars": {
"a": true
}
},
"webservers": [ "host2.local", "host3.local" ],
"tokyo": {
"hosts": [ "host1.local", "host4.local", "host5.local" ],
"vars": {
"b": false
},
"children": [ "shibuya", "ebisu" ]
},
"shibuya": [ "host6.local" ],
"ebisu": [ "host7.local" ]
}
14年6月10日火曜日
JSON: for `--host HOSTNAME`
Dynamic inventory: output
{
“localip”: “192.0.2.53”,
“virtualip”: “203.0.113.53”,
“global_fqdn”: “tagomoris.example.com”,
}
14年6月10日火曜日
Dynamic inventory reference
1. inventory --list
2. inventory --host host1.local
3. inventory --host host2.local
4. inventory --host host4.local
5. ...
14年6月10日火曜日
Playbook execution
$ ansible-playbook PLAYBOOK_PATH.yml
14年6月10日火曜日
Yabitz inventory
ansible-playbook
bin/yabitz_inventory
Yabitz
playbooks/PLAYBOOK.yaml
Servers
14年6月10日火曜日
Role based playbooks
Flat playbook directory
playbooks/*.yaml
playbooks/SERVICE_NAME/*.yaml
“hosts” are always roles
hosts: centos
hosts: centos6
hosts: hadoop-slave
hosts: hadoop-all-nodes:fluentd-all-nodes
14年6月10日火曜日
Yabitz tags and ROLEs
Tags
Server-type-tag (by studio3104 crawler)
centos
centos5, centos6
Role-based-tag
hadoop-all-nodes
hadoop-master, service-hadoop-master2
hadoop-slave
14年6月10日火曜日
Implementation examples
ansible.cfg
[defaults]
hostfile=/path/to/bin/yabitz_inventory
commands
$ ansible-playbook playbooks/update-openssl.yaml
$ TARGET_HOSTS=host1.local,host2.local 
ansible-playbook playbooks/SERVICE/foo.yaml
14年6月10日火曜日
No more host lists!
Ansible inventory is very simple and understandable
But we cannot use it for real world operations
especially for hundreds or thousands of hosts...
Use dynamic inventory!
14年6月10日火曜日
Role based playbook testing
Serverspec
testing without breaking operations
providing double check (beside of ansible)
14年6月10日火曜日
Serverspec directories
from http://serverspec.org/tutorial.html
host based spec directory tree
spec/
SERVERNAME/
function_spec.rb
and exec (`rake spec`)
“How to share serverspec tests among hosts”
http://serverspec.org/advanced_tips.html
static file based test sharing
14年6月10日火曜日
Specs and roles
Role based provisioning
roles-to-hosts resolution MUST be done dynamically
Helper command to get roles from playbooks
and role based spec directory
bin/kick-spec
spec/ROLE/*_spec.rb
14年6月10日火曜日
Implementation example(2)
$ bin/kick-spec playbooks/BOOK.yaml
$ bin/kick-spec playbooks/BOOK.yaml 
--host host1.local --host host2.local
$ bin/kick-spec --role latest_openssl 
--host host5.local
14年6月10日火曜日
Conclusion
DO NOT write same data in 2 or more files
USE master data from anywhere
Dynamic inventory makes it possible!
14年6月10日火曜日
NO MORE HOST
LISTS!!!!!!!!
Thanks!
14年6月10日火曜日
Appendix: “_meta”(1)
Special attribute of JSON for `--list`
To include host variables in single JSON result
No more exec: `--host HOST`
{
“shibuya”: [ “host6.local” ],
“ebisu”: [ “host7.local” ],
“_meta”: {
“hostvars”: {
“host6.local”: { “var1”: “value1”, “var2”: “value2” },
“host7.local”: { .... }
}
}
}
14年6月10日火曜日
Without `_meta`:
`--list` x1 and `--host` x1000 !
With `_meta`:
`--list` x1 only!
Appendix: “_meta”(2)
14年6月10日火曜日
Benchmark: time before task starts
w/ yabitz_inventory
for thousands of hosts
Appendix: “_meta”(3)
w/o _meta w/ _meta
Elapsed time 18min! 10sec!!!!
14年6月10日火曜日

More Related Content

What's hot

Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48Jozef Képesi
 
Observable Node.js Applications - EnterpriseJS
Observable Node.js Applications - EnterpriseJSObservable Node.js Applications - EnterpriseJS
Observable Node.js Applications - EnterpriseJSYunong Xiao
 
JavaScript code academy - introduction
JavaScript code academy - introductionJavaScript code academy - introduction
JavaScript code academy - introductionJaroslav Kubíček
 
Fabric
FabricFabric
FabricJS Lee
 
Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Žilvinas Kuusas
 
How to deploy your Rails application on Windows
How to deploy your Rails application on WindowsHow to deploy your Rails application on Windows
How to deploy your Rails application on Windows曦 徐
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleMukul Malhotra
 
Odoo Performance Limits
Odoo Performance LimitsOdoo Performance Limits
Odoo Performance LimitsOdoo
 
Traceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thTraceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thCarsten Sandtner
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Cloudflare
 
Refactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van WijngaardenRefactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van WijngaardenNETWAYS
 
Automatizando tarefas com grunt - O que era chato não é mais
Automatizando tarefas com grunt - O que era chato não é maisAutomatizando tarefas com grunt - O que era chato não é mais
Automatizando tarefas com grunt - O que era chato não é maisAnderson Aguiar
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxSignalFx
 
Simple Tips and Tricks with Ansible
Simple Tips and Tricks with AnsibleSimple Tips and Tricks with Ansible
Simple Tips and Tricks with AnsibleKeith Resar
 
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...NETWAYS
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from InstagramJay Ren
 

What's hot (20)

Ruby on the server
Ruby on the serverRuby on the server
Ruby on the server
 
Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48
 
Observable Node.js Applications - EnterpriseJS
Observable Node.js Applications - EnterpriseJSObservable Node.js Applications - EnterpriseJS
Observable Node.js Applications - EnterpriseJS
 
JavaScript code academy - introduction
JavaScript code academy - introductionJavaScript code academy - introduction
JavaScript code academy - introduction
 
Fabric
FabricFabric
Fabric
 
Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)
 
How to deploy your Rails application on Windows
How to deploy your Rails application on WindowsHow to deploy your Rails application on Windows
How to deploy your Rails application on Windows
 
Jk rubyslava 25
Jk rubyslava 25Jk rubyslava 25
Jk rubyslava 25
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Odoo Performance Limits
Odoo Performance LimitsOdoo Performance Limits
Odoo Performance Limits
 
Traceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thTraceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14th
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
 
Talk about fabric
Talk about fabricTalk about fabric
Talk about fabric
 
Refactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van WijngaardenRefactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
Refactoring Katello Installer modules - Ewoud Kohl van Wijngaarden
 
Automatizando tarefas com grunt - O que era chato não é mais
Automatizando tarefas com grunt - O que era chato não é maisAutomatizando tarefas com grunt - O que era chato não é mais
Automatizando tarefas com grunt - O que era chato não é mais
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
Simple Tips and Tricks with Ansible
Simple Tips and Tricks with AnsibleSimple Tips and Tricks with Ansible
Simple Tips and Tricks with Ansible
 
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
Mass-Migration of 5000 Servers to Foreman/Katello with bootstrap.py - Evgeni ...
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from Instagram
 

Similar to Dynamic Inventory: no more host lists!

PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...Pablo Godel
 
Ansible @ Red Hat | December 2015 Ansible Meetup in Melbourne
Ansible @ Red Hat | December 2015 Ansible Meetup in MelbourneAnsible @ Red Hat | December 2015 Ansible Meetup in Melbourne
Ansible @ Red Hat | December 2015 Ansible Meetup in MelbourneKen Thompson
 
Tame your Infrastructure with Puppet
Tame your Infrastructure with PuppetTame your Infrastructure with Puppet
Tame your Infrastructure with Puppetdelimiter
 
Perl family: 15 years of Perl 6 and Perl 5
Perl family: 15 years of Perl 6 and Perl 5Perl family: 15 years of Perl 6 and Perl 5
Perl family: 15 years of Perl 6 and Perl 5Michal Jurosz
 
Installation of LAMP Server with Ubuntu 14.10 Server Edition
Installation of LAMP Server with Ubuntu 14.10 Server EditionInstallation of LAMP Server with Ubuntu 14.10 Server Edition
Installation of LAMP Server with Ubuntu 14.10 Server EditionSammy Fung
 
Servicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoServicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoOrlando Del Aguila
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.jsSergi Mansilla
 
Unleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineUnleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineKenneth Kalmer
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationPuppet
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
OpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooOpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooinovex GmbH
 
Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Ian Huston
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Brno Perl Mongers 28.5.2015 - Perl family by mj41
Brno Perl Mongers 28.5.2015 - Perl family by mj41Brno Perl Mongers 28.5.2015 - Perl family by mj41
Brno Perl Mongers 28.5.2015 - Perl family by mj41Michal Jurosz
 
Dist::Zilla - Maximum Overkill for CPAN Distributions
Dist::Zilla - Maximum Overkill for CPAN DistributionsDist::Zilla - Maximum Overkill for CPAN Distributions
Dist::Zilla - Maximum Overkill for CPAN DistributionsRicardo Signes
 

Similar to Dynamic Inventory: no more host lists! (20)

Infrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / PuppetInfrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / Puppet
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
 
Ansible @ Red Hat | December 2015 Ansible Meetup in Melbourne
Ansible @ Red Hat | December 2015 Ansible Meetup in MelbourneAnsible @ Red Hat | December 2015 Ansible Meetup in Melbourne
Ansible @ Red Hat | December 2015 Ansible Meetup in Melbourne
 
Tame your Infrastructure with Puppet
Tame your Infrastructure with PuppetTame your Infrastructure with Puppet
Tame your Infrastructure with Puppet
 
Smartgears
SmartgearsSmartgears
Smartgears
 
Ansible
AnsibleAnsible
Ansible
 
Perl family: 15 years of Perl 6 and Perl 5
Perl family: 15 years of Perl 6 and Perl 5Perl family: 15 years of Perl 6 and Perl 5
Perl family: 15 years of Perl 6 and Perl 5
 
Installation of LAMP Server with Ubuntu 14.10 Server Edition
Installation of LAMP Server with Ubuntu 14.10 Server EditionInstallation of LAMP Server with Ubuntu 14.10 Server Edition
Installation of LAMP Server with Ubuntu 14.10 Server Edition
 
Servicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoServicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyecto
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.js
 
Unleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineUnleashing the Rails Asset Pipeline
Unleashing the Rails Asset Pipeline
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global Organization
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
OpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooOpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, too
 
Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Brno Perl Mongers 28.5.2015 - Perl family by mj41
Brno Perl Mongers 28.5.2015 - Perl family by mj41Brno Perl Mongers 28.5.2015 - Perl family by mj41
Brno Perl Mongers 28.5.2015 - Perl family by mj41
 
perlall
perlallperlall
perlall
 
Dist::Zilla - Maximum Overkill for CPAN Distributions
Dist::Zilla - Maximum Overkill for CPAN DistributionsDist::Zilla - Maximum Overkill for CPAN Distributions
Dist::Zilla - Maximum Overkill for CPAN Distributions
 
Sayoo odoo open_erp
Sayoo odoo open_erpSayoo odoo open_erp
Sayoo odoo open_erp
 

More from SATOSHI TAGOMORI

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speedSATOSHI TAGOMORI
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsSATOSHI TAGOMORI
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of RubySATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)SATOSHI TAGOMORI
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script ConfusingSATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubySATOSHI TAGOMORI
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsSATOSHI TAGOMORI
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the WorldSATOSHI TAGOMORI
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamSATOSHI TAGOMORI
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessSATOSHI TAGOMORI
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd SeasonSATOSHI TAGOMORI
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToSATOSHI TAGOMORI
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In RubySATOSHI TAGOMORI
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldSATOSHI TAGOMORI
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceSATOSHI TAGOMORI
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and ThenSATOSHI TAGOMORI
 

More from SATOSHI TAGOMORI (20)

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/Operations
 
Maccro Strikes Back
Maccro Strikes BackMaccro Strikes Back
Maccro Strikes Back
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of Ruby
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script Confusing
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive Operations
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the World
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: Bigdam
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise Business
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT To
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In Ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud Service
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 

Recently uploaded

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Dynamic Inventory: no more host lists!

  • 1. Dynamic inventory: No more host list! #ansibleja Ansible勉強会#1 2014/06/10 @tagomoris 14年6月10日火曜日
  • 2. TAGOMORI Satoshi (@tagomoris) LINE Corp. 14年6月10日火曜日
  • 3. Ansible Batch server operations add routing table entry deploy ssh keys update openssl Install/update middleware Hadoop, Presto, Fluentd (and its config/code ...) 14年6月10日火曜日
  • 4. Ansible: good points Minimal managed node requirements Simple tool chain and files YAML and many built-in modules Less stress of shell scripts Dynamic inventory 14年6月10日火曜日
  • 5. Ansible: bad points Less japanese case-studies Less japanese books and blog entries Less japanese users? -> No! 14年6月10日火曜日
  • 6. Inventory Hosts and groups Host variables / Group variables Group of groups ‘group_vars/’ and ‘host_vars/’ 14年6月10日火曜日
  • 7. Inventory: example mail01.local globalip=192.168.0.11 [blog] www[01:30].blog.local virtualip=203.0.113.63 app[01:50].blog.local master01.db.blog.local server_id=.... slave0[1:4].blog.local server_id=..???? [linenantoka] www[01:10].nantoka.line.local 14年6月10日火曜日
  • 8. ROLEs and TYPEs Roles (web, app, db, hadoop, ...) Groups (service-names, ...) OSs, Server models, Disk types (HDD, SSD, ioDrive, ...) IP addrs (local, global, virtual) ... and many more 14年6月10日火曜日
  • 9. Yabitz Our host management tool/server: WebUI and WebAPI (json) hostname[s], status, service, CPU, memory, disk, rack position, size, local/global/virtual IPs, virtual/ parent server, .... tags changes(history, diff) anything links to other internal web tools 14年6月10日火曜日
  • 10. Dynamic inventory Dynamic inventory plugins Cobbler external inventory script Example for linux install server AWS EC2 external inventory script Digital Ocean, Google Compute Engine, Linode, Zabbix, ... Mix inventories (static and dynamic) 14年6月10日火曜日
  • 11. Custom dynamic inventory Original scripts AS dynamic inventory “Developing Dynamic Inventory Sources” http://docs.ansible.com/developing_inventory.html executable program implement `--list` implement `--host HOSTNAME` 14年6月10日火曜日
  • 12. JSON: for `--list` Dynamic inventory: output { "databases": { "hosts": [ "host1.local", "host2.local" ], "vars": { "a": true } }, "webservers": [ "host2.local", "host3.local" ], "tokyo": { "hosts": [ "host1.local", "host4.local", "host5.local" ], "vars": { "b": false }, "children": [ "shibuya", "ebisu" ] }, "shibuya": [ "host6.local" ], "ebisu": [ "host7.local" ] } 14年6月10日火曜日
  • 13. JSON: for `--host HOSTNAME` Dynamic inventory: output { “localip”: “192.0.2.53”, “virtualip”: “203.0.113.53”, “global_fqdn”: “tagomoris.example.com”, } 14年6月10日火曜日
  • 14. Dynamic inventory reference 1. inventory --list 2. inventory --host host1.local 3. inventory --host host2.local 4. inventory --host host4.local 5. ... 14年6月10日火曜日
  • 15. Playbook execution $ ansible-playbook PLAYBOOK_PATH.yml 14年6月10日火曜日
  • 17. Role based playbooks Flat playbook directory playbooks/*.yaml playbooks/SERVICE_NAME/*.yaml “hosts” are always roles hosts: centos hosts: centos6 hosts: hadoop-slave hosts: hadoop-all-nodes:fluentd-all-nodes 14年6月10日火曜日
  • 18. Yabitz tags and ROLEs Tags Server-type-tag (by studio3104 crawler) centos centos5, centos6 Role-based-tag hadoop-all-nodes hadoop-master, service-hadoop-master2 hadoop-slave 14年6月10日火曜日
  • 19. Implementation examples ansible.cfg [defaults] hostfile=/path/to/bin/yabitz_inventory commands $ ansible-playbook playbooks/update-openssl.yaml $ TARGET_HOSTS=host1.local,host2.local ansible-playbook playbooks/SERVICE/foo.yaml 14年6月10日火曜日
  • 20. No more host lists! Ansible inventory is very simple and understandable But we cannot use it for real world operations especially for hundreds or thousands of hosts... Use dynamic inventory! 14年6月10日火曜日
  • 21. Role based playbook testing Serverspec testing without breaking operations providing double check (beside of ansible) 14年6月10日火曜日
  • 22. Serverspec directories from http://serverspec.org/tutorial.html host based spec directory tree spec/ SERVERNAME/ function_spec.rb and exec (`rake spec`) “How to share serverspec tests among hosts” http://serverspec.org/advanced_tips.html static file based test sharing 14年6月10日火曜日
  • 23. Specs and roles Role based provisioning roles-to-hosts resolution MUST be done dynamically Helper command to get roles from playbooks and role based spec directory bin/kick-spec spec/ROLE/*_spec.rb 14年6月10日火曜日
  • 24. Implementation example(2) $ bin/kick-spec playbooks/BOOK.yaml $ bin/kick-spec playbooks/BOOK.yaml --host host1.local --host host2.local $ bin/kick-spec --role latest_openssl --host host5.local 14年6月10日火曜日
  • 25. Conclusion DO NOT write same data in 2 or more files USE master data from anywhere Dynamic inventory makes it possible! 14年6月10日火曜日
  • 27. Appendix: “_meta”(1) Special attribute of JSON for `--list` To include host variables in single JSON result No more exec: `--host HOST` { “shibuya”: [ “host6.local” ], “ebisu”: [ “host7.local” ], “_meta”: { “hostvars”: { “host6.local”: { “var1”: “value1”, “var2”: “value2” }, “host7.local”: { .... } } } } 14年6月10日火曜日
  • 28. Without `_meta`: `--list` x1 and `--host` x1000 ! With `_meta`: `--list` x1 only! Appendix: “_meta”(2) 14年6月10日火曜日
  • 29. Benchmark: time before task starts w/ yabitz_inventory for thousands of hosts Appendix: “_meta”(3) w/o _meta w/ _meta Elapsed time 18min! 10sec!!!! 14年6月10日火曜日