Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Puppet + Ruby DSL
Search
Mateusz Lenik
May 23, 2012
Technology
1
250
Puppet + Ruby DSL
Short talk in Polish on Puppet and it's Ruby DSL
Mateusz Lenik
May 23, 2012
Tweet
Share
More Decks by Mateusz Lenik
See All by Mateusz Lenik
summon_process - orchestrating processes
mlen
0
68
Why you should give Erlang
mlen
1
140
Introduction to Erlang (in Polish)
mlen
1
100
Other Decks in Technology
See All in Technology
SRE NEXT CfP チームが語る 聞きたくなるプロポーザルとは / Proposals by the SRE NEXT CfP Team that are sure to be accepted
chaspy
1
590
はてなの開発20年史と DevOpsの歩み / DevOpsDays Tokyo 2025 Keynote
daiksy
6
1.5k
低レイヤを知りたいPHPerのためのCコンパイラ作成入門 / Building a C Compiler for PHPers Who Want to Dive into Low-Level Programming
tomzoh
0
220
Beyond {shiny}: The Future of Mobile Apps with R
colinfay
1
400
アジャイル脅威モデリング#1(脅威モデリングナイト#8)
masakane55
3
180
【2025年度新卒技術研修】100分で学ぶ サイバーエージェントのデータベース 活用事例とMySQLパフォーマンス調査
cyberagentdevelopers
PRO
5
7k
ブラウザのレガシー・独自機能を愛でる-Firefoxの脆弱性4選- / Browser Crash Club #1
masatokinugawa
1
410
AI AgentOps LT大会(2025/04/16) Algomatic伊藤発表資料
kosukeito
0
130
20250413_湘南kaggler会_音声認識で使うのってメルス・・・なんだっけ?
sugupoko
1
440
開発視点でAWS Signerを考えてみよう!! ~コード署名のその先へ~
masakiokuda
3
160
Devinで模索する AIファースト開発〜ゼロベースから始めるDevOpsの進化〜
potix2
PRO
7
3.1k
はじめてのSDET / My first challenge as a SDET
bun913
1
230
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
119
51k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Speed Design
sergeychernyshev
29
890
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
178
53k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
2.9k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Why Our Code Smells
bkeepers
PRO
336
57k
Writing Fast Ruby
sferik
628
61k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Transcript
Puppet + Ruby DSL Mateusz Lenik
Kim jestem?
• Mateusz Lenik • @_mlen, github.com/mlen • student III roku
Informatyki na PWr • użytkownik Ruby od 2010 • uczestnik GSoC 2012 @PuppetLabs
Czym jest Puppet?
None
• system zarządzania konfiguracją • konfiguracja jako kod • co
ma być zrobione, a nie jak ma być zrobione
Puppet Puppet Enterprise Puppet OpenSource
• podstawa dla Puppet Enterprise • ponad 350 modułów +
PuppetForge • konieczność własnego zarządzanie serwerem konfiguracji Puppet OpenSource
• Puppet OpenSource • + Support 24/7/365 • + GUI
webowe Puppet Enterprise
• kod wykonywany na serwerze • deklaratywny • jawne zależności
• template’y ERB • Puppet DSL • kod wykonywany na kliencie • deklaratywny • ukryte zależności • kiepska obsługa template’ów • CFEngine syntax Puppet vs CFEngine
• kod wykonywany na serwerze • deklaratywny • jawne zależności
• template’y ERB • Puppet DSL • kod wykonywany na kliencie • deklaratywny • ukryte zależności • template’y ERB • It’s Ruby! Puppet vs Chef
Kompilacja Kod Katalog Raport Wykonanie
• Fakty • Zasoby • Klasy • Węzły Katalog
Node Puppet Master Fakty
Node Puppet Master Katalog
Node Puppet Master Raport
Puppet DSL
• język deklaratywny • projektowany pod administratorów • wystarcza w
większości zastosowań
• nie da się w nim zrobić wszystkiego • ograniczone
instrukcje sterujące • specyficzna składnia “<|| ||>”
Ruby DSL
• dodany w ~2010 • lib/puppet/dsl/*.rb • nie dodaje zbyt
wiele abstrakcji
• gołe obiekty Puppet::Parser::* • brak części funkcjonalności • projekt
GSoC 2012 – rozwój Ruby DSL
None
Przykłady
class foo { notice("foo") } node "default" { include foo
} Klasy
hostclass :foo do notice ["foo"] end node "default" do create_resource
:class, :foo end Klasy
hostclass :foo do notice "foo" end node "default" do use
:foo end Klasy
class foo ($param = "value") { notice($param) } node "default"
{ class { "foo": param => "foo" } } Parametry
hostclass :foo, :arguments => {"param" => AST::String.new(:value => "value")} do
notice [scope.lookupvar("param")] end node "default" do create_resource :class, :foo, :param => "foo" end Parametry
hostclass :foo, :arguments => {:param => "value"} do notice params[:param]
end node "default" do use :foo, :param => "foo" end Parametry
node "default" { Notify { message => "foo" } notify
{"bar": } } Defaults
node "default" do scope.setdefaults(:notify, [Puppet::Parser::Resource::Param.new( :name => "message",:value => "foo"
)] ) notify "bar" end Defaults
node "default" do Notify :message => "foo" notify "bar" end
Defaults
Dalszy rozwój • Konwerter *.pp do *.rb • Inny DSL?
(Rake vs Thor)
Q&A