puppetconf 2016: writing custom types to manage web-based applications – tim cinel, atlassian

120
TIM CINEL BUILD WHISPERER ATLASSIAN @TIMCINEL Writing Custom Types to Manage Web-Based Applications

Upload: puppet

Post on 10-Jan-2017

97 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

TIM CINEL • BUILD WHISPERER • ATLASSIAN • @TIMCINEL

Writing Custom Types to Manage Web-Based Applications

Page 2: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

O U R S I T U AT I O N

W O R K E D E X A M P L E

D E M O

This Talk

N E X T S T E P S

Page 3: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Our Situation

Page 4: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Atlassian BambooSonatype Nexus

Atlassian’s Build Engineering team uses Puppet to manage manage many services, including…

• Repositories

• Security

• Proxy features

• Variables

• Global defaults

• Security

Page 5: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Managing config files has drawbacks…

• Nexus’s config file changes are picked up after restart

• Changes require brief service outage

• Changes made using Nexus and Bamboo UI during runtime not detected by Puppet

• Risk of configuration drift

• Most Bamboo configuration is in its database, not configuration files

• Ability to manage service is limited

Uptime Drift Limited

Page 6: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

How do we address these drawbacks?

Custom Types.

Page 7: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Concepts Refresher

Page 8: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Concept and terminology refresher

• Type

• Name

• Attributes

Can be considered as instances of types

Native Type

• Ruby implementation

• Attributes

• Provider(s)

Allows the representation of a type of resource in Puppet DSL

• Ruby implementation

• Type

Providers interact with target system to manage resources

Resource Type Provider

Page 9: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

What Are Custom Types?

user Type(Default)

useradd Provider for user Type

Manifest

bamboo_agent Type(Custom)

rest Provider for bamboo_agent Type

Manifest

Page 10: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

What Are Custom Types?

user Type(Default)

useradd Provider for user Type

Manifest

bamboo_agent Type(Custom)

rest Provider for bamboo_agent Type

Manifest

Page 11: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Custom Types can be created to manage

web-based services.

Page 12: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Custom Types

The Good Fine Configuration

No need to restart or reload services to pick up configuration changes.

No More DriftCustom types can directly query the application state runtime.

Fewer Restarts

If it’s configurable, a custom type can manage it. No need to manually tweak service configuration.

Page 13: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Custom Types

The Bad Authentication

Somebody has to create and maintain the custom types

More DependenciesThe module containing the custom types, custom providers and libraries

Engineering Cost

Configuration APIs often require credentials

Page 14: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

It’s not OK to manually configure

Bamboo instances

20

Page 15: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

bamboo_rest

Automated awayThese properties used to be configured on each server manually.

Not anymore. Thanks Custom Types!

https://forge.puppetlabs.com/atlassian/bamboo_rest

Page 16: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Nexus instances

18It’s not OK to allow config to drift on

Page 17: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

nexus_rest

Seamless changesChanges to these properties used to cause Nexus to restart, resulting in down time.

Not anymore. Thanks Custom Types!

https://forge.puppetlabs.com/atlassian/nexus_rest

Page 18: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Configuration Only

These modules are only responsible for configuring installed services via REST APIs.

Installation of these services is managed by another module.

Page 19: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 20: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 21: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Helpful Tools• Puppet• Ruby• Bundler• irb• curl and Firebug• Docker

"Tools" (CC BY-NC-ND 2.0) by jlgriffiths

Page 22: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

What makes Nexus 3 a good candidate?

• Completely different API to Nexus 2• Easy to run using Docker• A repository manager is a good fit with the Puppet resource model

Nexus 3We’e going to create custom types for Nexus 3 in our worked example.

Page 23: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Our Nexus 3 Types

Hosted Maven repository.

Attributes

• name

• online

• blobstore

Abstract storage used by repositories.

Attributes

• name

• path

nexus3_repository nexus3_blobstore

Page 24: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Discover Service Endpoints

Useful Endpoints• Query all resources• Create new resource• Delete existing resource• Update existing resource

Before starting work on a custom type, we should confirm the necessary endpoints are available.

Page 25: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Query Repositories

Nexus Endpoint Example

Page 26: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

File Structure• lib/ - All code

• lib/puppet/ Puppet API code• lib/puppet/provider/<type>/<provider>.rb Provider definition

• lib/puppet/type/<type>.rb Type definition

• lib/puppet_x helper code

Page 27: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 28: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Creating a new type

It’s as simple as adding these two lines.

tag: step-01

Page 29: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Creating a new type

It’s as simple as adding these two lines.

tag: step-01

Page 30: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Creating a new type

It’s as simple as adding these two lines.

tag: step-01

Page 31: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

It’s not quite ready.At least we have our dev loop now.

tag: step-01

Page 32: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Make sure RUBYLIB contains the path to lib/ before running puppet

It’s not quite ready.At least we have our dev loop now.

tag: step-01

Page 33: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

puppet resource and puppet apply are your friends

It’s not quite ready.At least we have our dev loop now.

tag: step-01

Page 34: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

puppet resource and puppet apply are your friends

It’s not quite ready.At least we have our dev loop now.

tag: step-01

Page 35: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Add namevar

A type’s namevar acts like a primary key

tag: step-02

Page 36: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Add namevar

A type’s namevar acts like a primary key

tag: step-02

Page 37: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

tag: step-02

Page 38: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

`puppet resource` won’t work until we implement a provider

tag: step-02

Page 39: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

`puppet apply` works because currently nexus3_repository is not ensurable

tag: step-02

Page 40: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Inline documentation and ensurablenessNon-ensurable types (like exec) do not have persistent state.

tag: step-03

Page 41: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Inline documentation and ensurablenessNon-ensurable types (like exec) do not have persistent state.

tag: step-03

Page 42: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Inline documentation and ensurablenessAdding inline documentation is easy.

tag: step-03

Page 43: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Oops. We broke it again.Looks like we need to implement a provider.

ensurable resources have state, so their provider must have logic to determine state

tag: step-03

Page 44: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Oops. We broke it again.Looks like we need to implement a provider.

ensurable resources have state, so their provider must have logic to determine state

tag: step-03

Page 45: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 46: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Before we start writing the provider…We could do with some helper classes so we don’t get bogged

down in implementation details.

tag: step-04

Page 47: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Before we start writing the provider…We could do with some helper classes so we don’t get bogged

down in implementation details.

helper classes in puppet_x

tag: step-04

Page 48: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Before we start writing the provider…We could do with some helper classes so we don’t get bogged

down in implementation details.

providers only need to use this class method

tag: step-04

Page 49: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Before we start writing the provider…We could do with some helper classes so we don’t get bogged

down in implementation details.

lazily load application config from file

tag: step-04

Page 50: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

A basic providertag: step-05

Page 51: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

A basic provider

the provider name is usually the name of the underlying tool used to manage resources

tag: step-05

Page 52: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

A basic provider

if implemented, self.instances is used to enumerate all resources of type

tag: step-05

Page 53: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

A basic provider

exists? provides logic for determining the presence of a resource

tag: step-05

Page 54: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

now that we’ve implemented a basic provider, puppet resource is working

tag: step-05

Page 55: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

now that we’ve implemented a basic provider, puppet resource is working

tag: step-05

Page 56: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

now that we’ve implemented a basic provider, puppet resource is working

tag: step-05

Page 57: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Ability to create and destroytag: step-06

Page 58: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Ability to create and destroymethod used when Puppet determines

that a resource should be created

tag: step-06

Page 59: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Ability to create and destroymethod used when Puppet wants to

destroy a resource

tag: step-06

Page 60: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

tag: step-06

Page 61: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

purges any discovered resources that are not in the manifest

tag: step-06

Page 62: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

ensures that repo_1 and number-two are present

tag: step-06

Page 63: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

destroyed unmanaged resources

tag: step-06

Page 64: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

created new resources

tag: step-06

Page 65: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now we’re getting somewhere.

tag: step-06

Page 66: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Well, sort of.resources are being created again

even though they already exist

tag: step-06

Page 67: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Implement prefetch`prefetch` must be defined if your `exists?` and getter methods don’t

query the system.

tag: step-07

Page 68: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Implement prefetch`prefetch` must be defined if your `exists?` and getter methods don’t

query the system.

tag: step-07

Page 69: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Yep, now we’ve got it.

tag: step-07

Page 70: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Yep, now we’ve got it.

no resources recreated

tag: step-07

Page 71: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 72: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Typetag: step-08

Page 73: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Type

nexus3_repository type now has an online attribute

tag: step-08

Page 74: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Type

input value restriction

tag: step-08

Page 75: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Type

input value normalisation

tag: step-08

Page 76: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Providertag: step-08

Page 77: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Provider

fetch the new attribute value from system and normalise it

tag: step-08

Page 78: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Provider

submit the new attribute to the system on create and update

tag: step-08

Page 79: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Providertag: step-08

Page 80: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Provider

property getters and setters

tag: step-08

Page 81: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding an attribute to the Provider

flush can be used to implement update logic

tag: step-08

Page 82: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

tag: step-08

Page 83: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

puppet resource is reporting online status

tag: step-08

Page 84: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

puppet apply updated the online attribute

tag: step-08

Page 85: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

puppet apply updated the online attribute

tag: step-08

Page 86: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Aw yeah.

puppet apply updated the online attribute

tag: step-08

Page 87: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding another attribute to the Typetag: step-09

Page 88: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding another attribute to the Type

custom input validation logic

tag: step-09

Page 89: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding another attribute to the Providertag: step-09

Page 90: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Adding another attribute to the Provider

immutable property using fail method

tag: step-09

Page 91: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

puppet resource is reporting blobstore value

tag: step-09

Page 92: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

puppet resource is reporting blobstore value

tag: step-09

Page 93: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

changing the blobstore value for an existing repository is failing

tag: step-09

Page 94: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

changing the blobstore value for an existing repository is failing

tag: step-09

Page 95: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

That’s nexus3_repository

done.

Page 96: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

"Silbury Hill" (CC BY 2.0) by rightee

We’re over the hump.

Page 97: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Page 98: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

We’ve created another TypeThis one is called nexus3_blobstore

We won’t walk through it like we did for nexus3_repository.

tag: step-10

Page 99: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Mostly good. But…tag: step-10

Page 100: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

tag: step-10

Page 101: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

tag: step-10

Page 102: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

nexus3_repositorys instances are being created before nexus3_blobstore instances. not good.

tag: step-10

Page 103: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

nexus3_repository instances are being created before nexus3_blobstore instances. not good.

tag: step-10

Page 104: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Relationships between TypesTypes can define soft require relationships with arbitrary resources

tag: step-11

Page 105: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Relationships between TypesTypes can define soft require relationships with arbitrary resources

if puppet manages this config file, then all nexus3_repository resources will depend on it

tag: step-11

Page 106: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Relationships between TypesTypes can define soft require relationships with arbitrary resources

the associated nexus3_blobstore resource will become a dependency (if it exists)

tag: step-11

Page 107: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Better.tag: step-11

Page 108: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

blobstore created before each dependent repository

tag: step-11

Page 109: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Even better.tag: step-11

Page 110: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

allow Puppet to manage the config file

tag: step-11

Page 111: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

prefetch fails due to missing provider configuration file

tag: step-11

Page 112: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Puppet creates config file, then succeeds to create resources in the right order using our custom types and providers

tag: step-11

Page 113: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

I M P L E M E N T A T Y P E

S E T U P

W R I T E A P R O V I D E R

A D D I N G M O R E P R O P E R T I E S

Worked Example

I N T E R A C T I O N B E T W E E N T Y P E S

Done 👌

Page 114: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

https://bitbucket.org/TCinel/puppet-camp-example/

Page 115: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Demo

Page 116: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Next Steps

Page 117: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Areas for Improvement

Publish to Forge

Incorporate better error handling, logging.

TestsUnit tests with RSpec, acceptance tests with Beaker and some CI.

Robustness

Make the module and its glorious types available to the community.

Page 118: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Puppet SourceShit Garry SaysPuppet Types and Providers http://garylarizza.com/blog/

Other Resources

Page 119: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Now go, and write some custom types

already!

Page 120: PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim Cinel, Atlassian

Thank you

TIM CINEL • BUILD WHISPERER • ATLASSIAN • @TIMCINEL

https://bitbucket.org/TCinel/puppet-camp-example/