Puppet Camp Berlin 2014: Module Rewriting the Smart Way

Post on 27-Jan-2015

108 views 0 download

Tags:

description

Puppet Camp Berlin 2014: Module Rewriting the Smart Way Presented by Martin Alfke

transcript

© Martin Alfke - 2014

Module (Re)writing the Smart Way

Martin Alfke <martin.alfke@buero20.org>

!Puppet Camp Berlin 2014

www.netways.de/puppetcamp

presented by

Check-In / Schedule

Please provide your name or a form of identification at the conference registration desk.

Location

Best Western Premier Hotel Moa Berlin

Stephanstrasse 41

10559 Berlin

Phone: +49 30 394043 0

Fax: +49 30 394043 999

info@hotel-moa-berlin.de

www.hotel-moa-berlin.de

Indoor parking: € 12,- /day

Date Puppet Camp (with accommodation)

Puppet Camp & OSDC bundle A (with accommodation)

Puppet Camp /

Puppet Camp & OSDC bundle B (no accommodation)

Thursday 10 April 2014

Puppet Camp Eve

* Please note:

Dinnerbuffet and introductory talk open only to Puppet Camp attendees who have reserved in advance

3.00pm

Hotel check-in

5.45pm – 7.00pm*

Dinner: Hotel restaurant (€ 26,- p.P. incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

5.45pm – 7.00pm*

Dinner: Hotel restaurant (incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

5.45pm – 7.00pm*

Dinner: Hotel restaurant (€ 26,- p.P. incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

Friday 11 April 2014

Puppet Camp

6.30am – 10.30am

Breakfast: Hotel restaurant

8.00am – 9.00am

Conference check-in

6.30am – 10.30am

Breakfast: Hotel restaurant

8.00am – 9.00am

Conference check-in

8.00am – 9.00am

Conference check-in

9.00am – 5.00pm

Speeches / Breaks

Approx. 5.00pm

End of Puppet Camp Berlin 2014

All attendees (speakers and participants) should adhere to the Puppet Labs Community Guidelines and Event Code of Conduct throughout this event: http://docs.puppetlabs.com/community/community_guidelines.html#event-code-of-conduct

© Martin Alfke - 2014

About Me

• Freelancer - Berlin/Germany

• Automation and Cfg Mgmt

• PCP 2013

• Module Contributor

• PuppetLabs Partner

Martin Alfke - at home

© Martin Alfke - 2014

What is this talk about?

The story of finding a module, learning that it is not useful for you, rethink and rewrite new shared, public module from scratch use it in your private roles and profiles and maintain it for other users.

Martin Alfke - SFO - Vesuvio Cafe

© Martin Alfke - 2014

What else?

Why contributing is better than building a golden porcelain tower in the dark of your closet.

or

The Puppet community way of getting a task done.

Martin Alfke - Berlin - Hotel du Rome

© Martin Alfke - 2014

The Task

Yes, we will have that task finished by yesterday !

http://www.mid-day.com/articles/day-29-in-bigg-boss-6-its-vrijesh-vs-major-sidhu/187949

© Martin Alfke - 2014

How to start?

We build a Puppet module !!

!

But … how should we start?

http://designtaxi.com/article/101902/How-To-Start/

© Martin Alfke - 2014

The Lone Warrior Way

Martin Alfke - Lassen County, California

© Martin Alfke - 2014

Coding Puppet …class webserver13 { package { 'apache2': ensure => present, } file { '/etc/apache2/sites-enabled/000-default': ensure => absent, } file { '/etc/apache2/sites-available/10_webserver13': ensure => file, source => 'puppet:///modules/webserver13/10_webserver13', } file { '/etc/apache2/mods-enabled/alias.conf': ensure => link, target => '/etc/apache2/mods-available/alias.conf', } file { '/etc/apache2/mods_enabled/alias.load': ensure => link, target => '/etc/apache2/mods-available/alias.load', } ...}

© Martin Alfke - 2014

Documentation / Bugfixes

Who is doing reviews? ☞ YOU

Who does documentation? ☞ YOU

Who will support you? ☞ YOU

http://lonewarriorswa.com/

© Martin Alfke - 2014

Features? Changes?

poor lonesome cowboy

I’m a poor lonesome cowboy I'm a long long way from home And this poor lonesome cowboy Has got a long long way to roam Over mountains over prairies From dawn till day is done My horse and me keep riding Into the setting sun

http://smellslikescreenspirit.com/2009/12/warner-bros-2010-preview/Poor lonesome cowboy - Pat Woods

© Martin Alfke - 2014

The Smart Way

Is there something available?

DevOps means to understand and reuse foreign code.

Use Puppet as a framework.

http://www.thindifference.com/2011/02/11/what-is-the-best-way-to-brand-the-middle/

© Martin Alfke - 2014

You are not alone

There are:

- companies using the same technology

- developers using the same framework

- sites which collect informations

- people talking about their solution

http://clivehicksjenkins.wordpress.com/

© Martin Alfke - 2014

Sources

puppetlabs.com

github.com

http://en.wikipedia.org/wiki/File:Microsoft-Staff-1978.jpg

© Martin Alfke - 2014

Found the solution?

Give feedback

Cooperate / Fix bugs / Improve

http://www.positoons.de/leistungen/character-design-info/eierlegende-wollmilchsau/

© Martin Alfke - 2014

Reusing Modules

class webserver13 { class { ‘::apache’: default_vhost => false, default_mods => false, } include ::apache::mod::alias ...}

© Martin Alfke - 2014

Reality?

We were checking for a module for cloud management

We found one

We talked to upstream:

“Oh, …, yes, …, this module, …, ahem,…, do yourself a favour, …, rewrite it”

or

What if you found nothing?

http://technorati.com/entertainment/celebrity/article/the-12-steps-of-reality-tv/

© Martin Alfke - 2014

Start Writing Public CodeStart a shareable, parameterised generic module

Always keep in mind separation of code and data

Let others decide which data source they want to use.

Do never put private data in your repo

Start using public repo immediately

Take care on proper license (AGPL, GPL,…)

http://www.security-faqs.com/why-your-company-should-issue-open-source-security-packages.html

© Martin Alfke - 2014

Combine Public/Private

Use your public module like any other (e.g. puppetlabs apache)

Add data only to your private (wrapper) module

Search for “Puppet Roles and Profiles” to understand this separation

http://www.internetmarketinginc.com/blog/share-or-not-share-thats-the-question-going-public-with-private-information/

© Martin Alfke - 2014

Responsibility

Be a responsive upstream

Always remember that other people might want to solve similar problems (not identical)

Make your code run on different platforms

Build a community around your module

Review Pull Requests in time

http://ryaneller.com/guest-post/guest-post-friday-the-power-of-responsibility/

© Martin Alfke - 2014

Improvement

Take your time to implement or merge improvements

Write test

Write good documentation and usage examples

Write more tests

Use your code

© Martin Alfke - 2014

Summary - 1

Work smart, not hard

Write good documentation, examples and tests

Write blog posts (mention your module and company)

Be a responsive and responsible upstream

Review other users contribution

Allow access if contributors code quality fits your requirements

Martin Alfke - SFO

© Martin Alfke - 2014

Summary - 2Never refactor

Restart prevents old bugs in new module

There will always come more requirements

Parameters, parameters, parameters

Let other users decide for their preferred data source

Use a proper open source licenseMartin Alfke - SFO

© Martin Alfke - 2014

Summary - 3

K.I.S.S

(Keep it simple and stupid)

“perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”

(Antoine de Saint-Exupéry)

Martin Alfke - SFO

© Martin Alfke - 2014

© Martin Alfke - 2014

www.netways.de/puppetcamp

presented by

Check-In / Schedule

Please provide your name or a form of identification at the conference registration desk.

Location

Best Western Premier Hotel Moa Berlin

Stephanstrasse 41

10559 Berlin

Phone: +49 30 394043 0

Fax: +49 30 394043 999

info@hotel-moa-berlin.de

www.hotel-moa-berlin.de

Indoor parking: € 12,- /day

Date Puppet Camp (with accommodation)

Puppet Camp & OSDC bundle A (with accommodation)

Puppet Camp /

Puppet Camp & OSDC bundle B (no accommodation)

Thursday 10 April 2014

Puppet Camp Eve

* Please note:

Dinnerbuffet and introductory talk open only to Puppet Camp attendees who have reserved in advance

3.00pm

Hotel check-in

5.45pm – 7.00pm*

Dinner: Hotel restaurant (€ 26,- p.P. incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

5.45pm – 7.00pm*

Dinner: Hotel restaurant (incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

5.45pm – 7.00pm*

Dinner: Hotel restaurant (€ 26,- p.P. incl. 1 soft drink)

7.00pm – 9.30pm*

“Puppet getting started” Room MOA 4

Friday 11 April 2014

Puppet Camp

6.30am – 10.30am

Breakfast: Hotel restaurant

8.00am – 9.00am

Conference check-in

6.30am – 10.30am

Breakfast: Hotel restaurant

8.00am – 9.00am

Conference check-in

8.00am – 9.00am

Conference check-in

9.00am – 5.00pm

Speeches / Breaks

Approx. 5.00pm

End of Puppet Camp Berlin 2014

All attendees (speakers and participants) should adhere to the Puppet Labs Community Guidelines and Event Code of Conduct throughout this event: http://docs.puppetlabs.com/community/community_guidelines.html#event-code-of-conduct

© Martin Alfke - 2014

PuppetForge

© Martin Alfke - 2014

PuppetForge - ?

© Martin Alfke - 2014

PuppetForge - 2

© Martin Alfke - 2014

PuppetForge - yea

© Martin Alfke - 2014

GitHub - woo

© Martin Alfke - 2014

PuppetForge

© Martin Alfke - 2014

GitHub

© Martin Alfke - 2014

GitHub - Module must haves

© Martin Alfke - 2014