SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
© Martin Alfke - 2014
Module (Re)writing the
Smart Way
Martin Alfke	

<martin.alfke@buero20.org>	

!
Puppet Camp London 2014
© 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 Code
Start 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 - 2
Never 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 license
Martin 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
Module Rewriting the
Smart Way
Martin Alfke	

<martin.alfke@buero20.org>

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Configuring Highly Scalable Compile Masters, Vasco Cardoso, AWS
Configuring Highly Scalable Compile Masters, Vasco Cardoso, AWSConfiguring Highly Scalable Compile Masters, Vasco Cardoso, AWS
Configuring Highly Scalable Compile Masters, Vasco Cardoso, AWS
 
Auto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag StyleAuto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag Style
 
Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
 
Ways to generate PDF from Python Web applications, Gaël Le Mignot
Ways to generate PDF from Python Web applications, Gaël Le MignotWays to generate PDF from Python Web applications, Gaël Le Mignot
Ways to generate PDF from Python Web applications, Gaël Le Mignot
 
Virtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 May
 
Learning Puppet Chapter 1
Learning Puppet Chapter 1Learning Puppet Chapter 1
Learning Puppet Chapter 1
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerModern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, PuppetPuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
 
Python in the land of serverless
Python in the land of serverlessPython in the land of serverless
Python in the land of serverless
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Tools and Virtualization to Manage our Operations at Puppet Labs - PuppetConf...
Tools and Virtualization to Manage our Operations at Puppet Labs - PuppetConf...Tools and Virtualization to Manage our Operations at Puppet Labs - PuppetConf...
Tools and Virtualization to Manage our Operations at Puppet Labs - PuppetConf...
 
Puppet at Pinterest
Puppet at PinterestPuppet at Pinterest
Puppet at Pinterest
 
Puppet at GitHub / ChatOps
Puppet at GitHub / ChatOpsPuppet at GitHub / ChatOps
Puppet at GitHub / ChatOps
 
Pro Puppet
Pro PuppetPro Puppet
Pro Puppet
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Lessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet AgentsLessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet Agents
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
 
Automated Deployment With Phing
Automated Deployment With PhingAutomated Deployment With Phing
Automated Deployment With Phing
 

Destaque (6)

Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentation
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebula
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
 
One
OneOne
One
 
Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and Provides
 

Semelhante a Puppet camp london-modulerewritingsmartway

FAKE (F# Make) & Automation
FAKE (F# Make) & AutomationFAKE (F# Make) & Automation
FAKE (F# Make) & Automation
Sergey Tihon
 
Cf objective2014 software-craftsmanship
Cf objective2014 software-craftsmanshipCf objective2014 software-craftsmanship
Cf objective2014 software-craftsmanship
ColdFusionConference
 

Semelhante a Puppet camp london-modulerewritingsmartway (20)

Puppet Camp Berlin 2014: Module Rewriting the Smart Way
Puppet Camp Berlin 2014: Module Rewriting the Smart Way Puppet Camp Berlin 2014: Module Rewriting the Smart Way
Puppet Camp Berlin 2014: Module Rewriting the Smart Way
 
Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...
 
FAKE (F# Make) & Automation
FAKE (F# Make) & AutomationFAKE (F# Make) & Automation
FAKE (F# Make) & Automation
 
From Flash to HTML5 in a flash: your ultimate guide to converting legacy e-le...
From Flash to HTML5 in a flash: your ultimate guide to converting legacy e-le...From Flash to HTML5 in a flash: your ultimate guide to converting legacy e-le...
From Flash to HTML5 in a flash: your ultimate guide to converting legacy e-le...
 
Technologies, Places, Business Models for Open Design @ Pixelversity, Helsink...
Technologies, Places, Business Models for Open Design @ Pixelversity, Helsink...Technologies, Places, Business Models for Open Design @ Pixelversity, Helsink...
Technologies, Places, Business Models for Open Design @ Pixelversity, Helsink...
 
The Art of Writing Efficient Software
The Art of Writing Efficient SoftwareThe Art of Writing Efficient Software
The Art of Writing Efficient Software
 
xAPI for Training Managers
xAPI for Training ManagersxAPI for Training Managers
xAPI for Training Managers
 
Go_ Building Web Applications ( PDFDrive.com ).pdf
Go_ Building Web Applications ( PDFDrive.com ).pdfGo_ Building Web Applications ( PDFDrive.com ).pdf
Go_ Building Web Applications ( PDFDrive.com ).pdf
 
CloudFoundry-summit-2015-a-look-back
CloudFoundry-summit-2015-a-look-backCloudFoundry-summit-2015-a-look-back
CloudFoundry-summit-2015-a-look-back
 
Resume
ResumeResume
Resume
 
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
 
Another Copernican Revolution: maintenance first, projects second (European D...
Another Copernican Revolution: maintenance first, projects second (European D...Another Copernican Revolution: maintenance first, projects second (European D...
Another Copernican Revolution: maintenance first, projects second (European D...
 
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
 
Cf objective2014 software-craftsmanship
Cf objective2014   software-craftsmanshipCf objective2014   software-craftsmanship
Cf objective2014 software-craftsmanship
 
Cf objective2014 software-craftsmanship
Cf objective2014 software-craftsmanshipCf objective2014 software-craftsmanship
Cf objective2014 software-craftsmanship
 
NRWConf - Workshop Mobile Apps
NRWConf - Workshop Mobile AppsNRWConf - Workshop Mobile Apps
NRWConf - Workshop Mobile Apps
 
Omnibus to the future!
Omnibus to the future!Omnibus to the future!
Omnibus to the future!
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppet
 

Mais de Martin Alfke

Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
Martin Alfke
 

Mais de Martin Alfke (10)

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdf
 
HashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudHashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the Cloud
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdf
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy in
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized world
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parser
 
developing sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetdeveloping sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppet
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Puppet camp london-modulerewritingsmartway

  • 1. © Martin Alfke - 2014 Module (Re)writing the Smart Way Martin Alfke <martin.alfke@buero20.org> ! Puppet Camp London 2014
  • 2. © Martin Alfke - 2014 About Me • Freelancer - Berlin/Germany • Automation and Cfg Mgmt • PCP 2013 • Module Contributor • PuppetLabs Partner Martin Alfke - at home
  • 3. © 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
  • 4. © 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
  • 5. © 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
  • 6. © Martin Alfke - 2014 How to start? We build a Puppet module !! ! But … how should we start? http://designtaxi.com/article/101902/How-To-Start/
  • 7. © Martin Alfke - 2014 The Lone Warrior Way Martin Alfke - Lassen County, California
  • 8. © 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', } ... }
  • 9. © Martin Alfke - 2014 Documentation / Bugfixes Who is doing reviews? ☞ YOU Who does documentation? ☞ YOU Who will support you? ☞ YOU http://lonewarriorswa.com/
  • 10. © 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
  • 11. © 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/
  • 12. © 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/
  • 13. © Martin Alfke - 2014 Sources puppetlabs.com github.com http://en.wikipedia.org/wiki/File:Microsoft-Staff-1978.jpg
  • 14. © Martin Alfke - 2014 Found the solution? Give feedback Cooperate / Fix bugs / Improve http://www.positoons.de/leistungen/character-design-info/eierlegende-wollmilchsau/
  • 15. © Martin Alfke - 2014 Reusing Modules class webserver13 { class { ‘::apache’: default_vhost => false, default_mods => false, } include ::apache::mod::alias ... }
  • 16. © 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/
  • 17. © Martin Alfke - 2014 Start Writing Public Code Start 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
  • 18. © 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/
  • 19. © 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/
  • 20. © 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
  • 21. © 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
  • 22. © Martin Alfke - 2014 Summary - 2 Never 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 license Martin Alfke - SFO
  • 23. © 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
  • 24. © Martin Alfke - 2014 Module Rewriting the Smart Way Martin Alfke <martin.alfke@buero20.org>