Slide 1

Slide 1 text

Cookbook Patterns Poise Noah Kantrowitz

Slide 2

Slide 2 text

Me •PSF + PyCon •Balanced •Chef •Making things

Slide 3

Slide 3 text

•What? •Why? •How?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

cook·book A description of a piece of infrastructure

Slide 8

Slide 8 text

Role Cookbook Recipe Resource

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

leak·y ab·strac·tion Incomplete hiding of internal details

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

•Fork (and patch) •Wrapper •Rewind

Slide 13

Slide 13 text

Inheritance

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

10x

Slide 16

Slide 16 text

Poise

Slide 17

Slide 17 text

•Helpers •DSL extensions •Patterns

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

•jenkins •jenkins_job •jenkins_credential •jenkins_plugin

Slide 20

Slide 20 text

•ci_job •ci_pipeline •name_ci_pipeline

Slide 21

Slide 21 text

Using Poise

Slide 22

Slide 22 text

class Chef class ... ... end end

Slide 23

Slide 23 text

Resource::Foo < Resource Provider::Foo < Provider

Slide 24

Slide 24 text

•Foo => foo •FooBar => foo_bar •FOO => f_o_o

Slide 25

Slide 25 text

class ... include Poise ... end

Slide 26

Slide 26 text

action(:one, :two) attribute(:name, kind_of: String)

Slide 27

Slide 27 text

attribute(:opts, option_collector: true ) opts do foo 'bar' end

Slide 28

Slide 28 text

attribute(:path, default: lazy { ... })

Slide 29

Slide 29 text

attribute(:config, template: true) attribute('', template: true)

Slide 30

Slide 30 text

foo ... do source 'cfg.erb' end foo ... do content 'x=1' end

Slide 31

Slide 31 text

file ... do content nr.content end

Slide 32

Slide 32 text

class Provider... def action_one ... end end

Slide 33

Slide 33 text

notifying_block do ... end

Slide 34

Slide 34 text

include_recipe ...

Slide 35

Slide 35 text

Putting It Together

Slide 36

Slide 36 text

class Res::Foo < Res include Poise action(:one) attribute(:pkg) attribute(:ver) end

Slide 37

Slide 37 text

def action_one notifying_block do install_pkg write_config end end

Slide 38

Slide 38 text

def install_pkg package nr.pkg do version nr.ver end end

Slide 39

Slide 39 text

def install_pkg r = super r.package_name( 'my-thing') r end

Slide 40

Slide 40 text

Next Steps

Slide 41

Slide 41 text

Subresources

Slide 42

Slide 42 text

Cookbook Tiers

Slide 43

Slide 43 text

•poise-proxy •poise-appenv •poise-service?

Slide 44

Slide 44 text

•attribute(node: ...) •group do ... end •after(:one)

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Thank You