SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Writing and Publishing 
Puppet Modules 
Colleen Murphy
Hello 
Me (then): 
Student sysadmin at the IT department for 
Portland State University’s College of Engineering 
aka 
The Computer Action Team (TheCAT) 
github.com/pdxcat forge.puppetlabs. 
com/pdxcat
Hello 
Me (now): 
Module engineer at Puppet Labs
What is a puppet module? 
● An encapsulation of configuration for a 
service 
● A structure containing an organized set of 
puppet code and data 
● Analogous to a package, gem, python library 
● The place where your code goes
What should a module do? 
● Set up a service, such as: 
○ ssh 
○ mysql 
○ apache 
○ sudo 
● Extend puppet functionality. Examples: 
○ puppetlabs/stdlib 
○ puppetlabs/concat
The strategy 
Set up the service… 
without puppet. 
Then iterate.
Layout of a module 
yourmodule/ 
➔ manifests/ # where your puppet code goes 
➔ files/ # flat configuration files 
➔ templates/ # dynamic configuration files 
➔ lib/ # plugins: types and providers, functions, 
| facts, etc 
➔ tests/ # smoke tests/example usage 
➔ spec/ # automated tests
Layout of a module 
yourmodule/ 
➔ manifests/ # where your puppet code goes 
➔ files/ # flat configuration files 
➔ templates/ # dynamic configuration files
Layout of a module 
yourmodule/ 
➔ manifests/ # where your puppet code goes 
➔ files/ # flat configuration files 
➔ templates/ # dynamic configuration files 
➔ tests/ # smoke tests/example usage 
➔ spec/ # automated tests
Starting out 
$ puppet module generate cmurphy-ssh && mv cmurphy-ssh ssh 
$ mkdir ssh/{files,templates}
Writing your first module 
# manifests/init.pp 
class ssh { 
}
Writing your first module 
# manifests/init.pp 
class ssh { 
package { 'openssh-server': 
ensure => installed, 
} 
}
Writing your first module 
# manifests/init.pp 
class ssh { 
package { 'openssh-server': 
ensure => installed, 
} 
file { '/etc/ssh/sshd_config': 
source => "puppet:///modules/ssh/sshd_config", 
require => Package['openssh-server'], 
} 
}
Writing your first module 
# ... 
package { 'openssh-server': 
ensure => installed, 
} 
file { '/etc/ssh/sshd_config': 
source => "puppet:///modules/ssh/sshd_config", 
require => Package['openssh-server'], 
} 
service { 'ssh': 
ensure => running, 
enable => true, 
subscribe => File['/etc/ssh/sshd_config'], 
}
Drop in a configuration file 
# files/sshd_config 
# Managed by Puppet 
# What ports, IPs and protocols we listen for 
Port 22 
Protocol 2 
# Logging 
SyslogFacility AUTH 
LogLevel INFO 
# Authentication: 
LoginGraceTime 120 
PermitRootLogin no 
StrictModes yes 
# ...
Writing your first module 
# manifests/init.pp 
class ssh { 
package { 'openssh-server': 
ensure => installed, 
} 
file { '/etc/ssh/sshd_config': 
source => "puppet:///modules/ssh/sshd_config", 
require => Package['openssh-server'], 
} 
service { 'ssh': 
ensure => running, 
enable => true, 
subscribe => File['/etc/ssh/sshd_config'], 
} 
}
Writing your first module 
# tests/init.pp 
include ssh 
# or 
# /etc/puppet/manifests/site.pp 
node default { 
include ssh 
}
Needs more portability! 
No one should have to change your code or 
your files in order to use your module.
Template your module 
# templates/sshd_config.erb 
# Managed by Puppet 
# What ports, IPs and protocols we listen for 
Port <%= @port %> 
Protocol 2 
# Logging 
SyslogFacility <%= @syslog_facility %> 
LogLevel <%= @log_level %> 
# Authentication: 
LoginGraceTime 120 
PermitRootLogin <%= @permit_root_login %> 
StrictModes yes 
# ...
Template your module 
# manifests/init.pp 
class ssh ( 
$port = 22, 
$syslog_facility = 'AUTH', 
$log_level = 'INFO', 
$permit_root_login = 'no', 
) { 
# ... 
file { '/etc/ssh/sshd_config': 
content => 
template('ssh/sshd_config.erb'), 
require => Package['openssh-server'], 
} # ... 
# tests/init.pp or site.pp 
# ... 
class { 'ssh': 
permit_root_login => 'without-password', 
}
Templating strategies 
# manifests/init.pp 
class ssh ( 
$ports = [ 22 ], 
$options = {} 
) { 
# ... 
file { '/etc/ssh/sshd_config': 
content => 
template('ssh/sshd_config.erb'), 
require => Package['openssh-server'], 
} 
# ... 
# Applying the class 
class { 'ssh': 
ports => [ 22, 2222 ], 
options => { 
'PermitRootLogin' => 'no', 
} 
}
Templating strategies 
# templates/sshd_config.erb 
# Managed by Puppet 
<% @ports.each do |port| %> 
Port <%= port %> 
<% end %> 
<% @options.each do |k,v| %> 
<%= k %> <%= v %> 
<% end %>
Templating strategies 
● Take advantage of Include conf.d/* directives 
file { '/etc/collectd.conf': 
ensure => present, 
content => 'Include "conf.d/*.conf"n', 
} 
# … 
define collectd::plugins::exec { 
file { "${name}.load": 
path => "${conf_dir}/${name}.conf", 
content => template('collectd/exec.conf.erb'), 
} 
}
Beyond templates 
● puppetlabs/concat 
concat { '/etc/motd': } 
concat::fragment { 'welcome': 
target => '/etc/motd', 
content => 'Welcome to Redhat', 
order => '01', 
} 
concat::fragment { 'legal': 
# … 
}
Beyond templates 
● puppetlabs/inifile 
ini_setting { 'puppetdbserver': 
ensure => present, 
section => 'main', 
path => "${puppet_confdir}/puppetdb.conf", 
setting => 'server', 
value => $server, 
} 
ini_setting { 'puppetdbport': 
# … 
}
Beyond Templates 
● augeas 
augeas { 'sshd_config_permit_root_login': 
context => '/files/etc/ssh/sshd_config', 
changes => "set PermitRootLogin $permit_root_login", 
require => File['/etc/ssh/sshd_config'], 
} 
● domcleal/augeasproviders 
sshd_config { "PermitRootLogin": 
ensure => present, 
value => $permit_root_login, 
}
Smart Parameter Defaults 
# manifests/params.pp 
class ssh::params { 
case $::osfamily { 
'Debian': { 
$ssh_svc = 'ssh' 
} 
'RedHat': { 
$ssh_svc = 'sshd' 
} 
default: { 
fail("${::osfamily} is not supported.") 
} 
} 
} 
# manifests/init.pp 
class ssh ( 
# ... 
) { 
include ssh::params 
service { $ssh::params::ssh_svc: 
ensure => running, 
enable => true, 
} 
# ...
The Forge
Publishing your module 
metadata.json 
● module name 
● version (SemVer) 
● author 
● summary 
● source 
● issues URL 
● operating system support 
● dependencies
Publishing your module 
Use semantic versioning! 
semver.org 
Major.Minor.Patch
Publishing your module 
Changelog 
## 2013-12-05 Release 0.10.0 
### Summary: 
This release adds FreeBSD osfamily support and various other improvements to some 
mods. 
### Features: 
- Add suPHP_UserGroup directive to directory context 
- Add support for ScriptAliasMatch directives 
... 
## 2013-09-06 Release 0.9.0 
### Summary: 
...
Publishing your module 
README 
● docs.puppetlabs.com/puppet/3/reference/READMEtemplate.markdown
Publishing your module 
license 
● choosealicense.com
Publishing your module 
$ cd ssh/ 
$ puppet module build . 
$ ls pkg/ 
cmurphy-ssh-0.0.1 cmurphy-ssh-0.0.1.tar.gz
Testing 
Why we test: 
● Testing gives us (some) assurance that our 
code won’t break production systems 
● Contributors can run tests without having 
the same infrastructure as you
Testing your module 
● Smoke testing 
# puppet apply --noop tests/init.pp
Testing your module 
● Unit testing: rspec-puppet 
○ rspec-puppet.com 
$ bundle exec rake spec
Testing your module 
# spec/classes/init_spec.rb 
require 'spec_helper' 
describe 'collectd' do 
let :facts do 
{:osfamily => 'RedHat'} 
end 
it { should contain_package('collectd').with( 
:ensure => 'installed' 
)} 
it { should contain_service('collectd').with( 
:ensure => 'running' 
)} 
# ...
Testing your module 
● Acceptance testing: beaker-rspec 
○ github.com/puppetlabs/beaker 
○ youtu.be/jEJmUQOlaDg 
$ bundle exec rspec spec/acceptance
Testing your module 
# spec/acceptance/class_spec.rb 
require 'spec_helper_acceptance' 
case fact('osfamily') 
# ... 
describe 'ssh class' do 
context 'default parameters' do 
it 'should work with no errors' do 
pp = "class { 'ssh': }" 
apply_manifest(pp, :catch_failures => true) 
apply_manifest(pp, :catch_changes => true) 
end 
describe service(servicename) do 
it { should be_running } 
end 
# ...
Testing your module 
● Linting 
$ bundle exec rake lint
Maintaining your module 
Update your code 
● fix bugs 
● add features 
● manage pull requests
Installing modules 
Search for modules on forge.puppetlabs.com or 
puppet module search ssh 
Then install with 
puppet module install saz/ssh
Where now? 
Learn more at 
docs.puppetlabs.com/guides/module_guides/bgtm.html 
Get help at 
Ask: ask.puppetlabs.com 
IRC: #puppet on freenode 
Mailing list: groups.google.com/group/puppet-users
Thanks! 
Find me: 
Colleen Murphy 
freenode: crinkle 
github: cmurphy 
twitter: @pdx_krinkle

Weitere ähnliche Inhalte

Was ist angesagt?

Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojobpmedley
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to doPuppet
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetWalter Heck
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Puppet
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?ConFoo
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017Jumping Bean
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101hendrikvb
 

Was ist angesagt? (20)

Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to do
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
Nubilus Perl
Nubilus PerlNubilus Perl
Nubilus Perl
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 

Andere mochten auch

Delivering value pricing through b2 b sales teams slide deck
Delivering value pricing through b2 b sales teams slide deckDelivering value pricing through b2 b sales teams slide deck
Delivering value pricing through b2 b sales teams slide deckLeveragePoint Innovations
 
Quantifying value: Working Through the Math
Quantifying value: Working Through the Math Quantifying value: Working Through the Math
Quantifying value: Working Through the Math LeveragePoint Innovations
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet
 
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopPuppet
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development WorkflowJeffery Smith
 
Devops, Dungeons & Dragons
Devops, Dungeons & Dragons Devops, Dungeons & Dragons
Devops, Dungeons & Dragons David Lutz
 
Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Aaron Bernstein
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of PackerFreyr Lin
 
How do you measure value?
How do you measure value?How do you measure value?
How do you measure value?Thoughtworks
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerGeorge Miranda
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps beginsJeff Hung
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
C#: Globalization and localization
C#: Globalization and localizationC#: Globalization and localization
C#: Globalization and localizationRohit Vipin Mathews
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer Hiroshi SHIBATA
 
Superb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with SensuSuperb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with SensuPaul O'Connor
 
Puppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetPuppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetNan Liu
 

Andere mochten auch (20)

Delivering value pricing through b2 b sales teams slide deck
Delivering value pricing through b2 b sales teams slide deckDelivering value pricing through b2 b sales teams slide deck
Delivering value pricing through b2 b sales teams slide deck
 
Quantifying value: Working Through the Math
Quantifying value: Working Through the Math Quantifying value: Working Through the Math
Quantifying value: Working Through the Math
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
 
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
Devops, Dungeons & Dragons
Devops, Dungeons & Dragons Devops, Dungeons & Dragons
Devops, Dungeons & Dragons
 
Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)
 
Docker
Docker Docker
Docker
 
Docker internals
Docker internalsDocker internals
Docker internals
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of Packer
 
How do you measure value?
How do you measure value?How do you measure value?
How do you measure value?
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps begins
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
C#: Globalization and localization
C#: Globalization and localizationC#: Globalization and localization
C#: Globalization and localization
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer
 
Connascence
ConnascenceConnascence
Connascence
 
Superb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with SensuSuperb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with Sensu
 
Puppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetPuppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with Puppet
 

Ähnlich wie Writing and Publishing Puppet Modules - PuppetConf 2014

Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet ModulesPuppet
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPuppet
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules Puppet
 
A Brief Introduction to Writing and Understanding Puppet Modules
A Brief Introduction to Writing and Understanding Puppet ModulesA Brief Introduction to Writing and Understanding Puppet Modules
A Brief Introduction to Writing and Understanding Puppet ModulesDavid Phillips
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Carlos Sanchez
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceohadlevy
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkMichael Peacock
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011Carlos Sanchez
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesBram Vogelaar
 
Puppet Intfrastructure as Code
Puppet Intfrastructure as CodePuppet Intfrastructure as Code
Puppet Intfrastructure as CodeSamir Chekkal
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?Tushar Sharma
 

Ähnlich wie Writing and Publishing Puppet Modules - PuppetConf 2014 (20)

Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet Modules
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modules
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules
 
A Brief Introduction to Writing and Understanding Puppet Modules
A Brief Introduction to Writing and Understanding Puppet ModulesA Brief Introduction to Writing and Understanding Puppet Modules
A Brief Introduction to Writing and Understanding Puppet Modules
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Puppet
PuppetPuppet
Puppet
 
Puppet
PuppetPuppet
Puppet
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conference
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet Profiles
 
Puppet Intfrastructure as Code
Puppet Intfrastructure as CodePuppet Intfrastructure as Code
Puppet Intfrastructure as Code
 
Puppi. Puppet strings to the shell
Puppi. Puppet strings to the shellPuppi. Puppet strings to the shell
Puppi. Puppet strings to the shell
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
 

Mehr von Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscodePuppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codePuppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approachPuppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationPuppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliancePuppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppetPuppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkPuppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy SoftwarePuppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User GroupPuppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsPuppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyPuppet
 

Mehr von Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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.pptxHampshireHUG
 
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...Drew Madelung
 
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 Scriptwesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 Nanonetsnaman860154
 
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 WorkerThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
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...
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Writing and Publishing Puppet Modules - PuppetConf 2014

  • 1. Writing and Publishing Puppet Modules Colleen Murphy
  • 2. Hello Me (then): Student sysadmin at the IT department for Portland State University’s College of Engineering aka The Computer Action Team (TheCAT) github.com/pdxcat forge.puppetlabs. com/pdxcat
  • 3. Hello Me (now): Module engineer at Puppet Labs
  • 4. What is a puppet module? ● An encapsulation of configuration for a service ● A structure containing an organized set of puppet code and data ● Analogous to a package, gem, python library ● The place where your code goes
  • 5. What should a module do? ● Set up a service, such as: ○ ssh ○ mysql ○ apache ○ sudo ● Extend puppet functionality. Examples: ○ puppetlabs/stdlib ○ puppetlabs/concat
  • 6. The strategy Set up the service… without puppet. Then iterate.
  • 7. Layout of a module yourmodule/ ➔ manifests/ # where your puppet code goes ➔ files/ # flat configuration files ➔ templates/ # dynamic configuration files ➔ lib/ # plugins: types and providers, functions, | facts, etc ➔ tests/ # smoke tests/example usage ➔ spec/ # automated tests
  • 8. Layout of a module yourmodule/ ➔ manifests/ # where your puppet code goes ➔ files/ # flat configuration files ➔ templates/ # dynamic configuration files
  • 9. Layout of a module yourmodule/ ➔ manifests/ # where your puppet code goes ➔ files/ # flat configuration files ➔ templates/ # dynamic configuration files ➔ tests/ # smoke tests/example usage ➔ spec/ # automated tests
  • 10. Starting out $ puppet module generate cmurphy-ssh && mv cmurphy-ssh ssh $ mkdir ssh/{files,templates}
  • 11. Writing your first module # manifests/init.pp class ssh { }
  • 12. Writing your first module # manifests/init.pp class ssh { package { 'openssh-server': ensure => installed, } }
  • 13. Writing your first module # manifests/init.pp class ssh { package { 'openssh-server': ensure => installed, } file { '/etc/ssh/sshd_config': source => "puppet:///modules/ssh/sshd_config", require => Package['openssh-server'], } }
  • 14. Writing your first module # ... package { 'openssh-server': ensure => installed, } file { '/etc/ssh/sshd_config': source => "puppet:///modules/ssh/sshd_config", require => Package['openssh-server'], } service { 'ssh': ensure => running, enable => true, subscribe => File['/etc/ssh/sshd_config'], }
  • 15. Drop in a configuration file # files/sshd_config # Managed by Puppet # What ports, IPs and protocols we listen for Port 22 Protocol 2 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 120 PermitRootLogin no StrictModes yes # ...
  • 16. Writing your first module # manifests/init.pp class ssh { package { 'openssh-server': ensure => installed, } file { '/etc/ssh/sshd_config': source => "puppet:///modules/ssh/sshd_config", require => Package['openssh-server'], } service { 'ssh': ensure => running, enable => true, subscribe => File['/etc/ssh/sshd_config'], } }
  • 17. Writing your first module # tests/init.pp include ssh # or # /etc/puppet/manifests/site.pp node default { include ssh }
  • 18. Needs more portability! No one should have to change your code or your files in order to use your module.
  • 19. Template your module # templates/sshd_config.erb # Managed by Puppet # What ports, IPs and protocols we listen for Port <%= @port %> Protocol 2 # Logging SyslogFacility <%= @syslog_facility %> LogLevel <%= @log_level %> # Authentication: LoginGraceTime 120 PermitRootLogin <%= @permit_root_login %> StrictModes yes # ...
  • 20. Template your module # manifests/init.pp class ssh ( $port = 22, $syslog_facility = 'AUTH', $log_level = 'INFO', $permit_root_login = 'no', ) { # ... file { '/etc/ssh/sshd_config': content => template('ssh/sshd_config.erb'), require => Package['openssh-server'], } # ... # tests/init.pp or site.pp # ... class { 'ssh': permit_root_login => 'without-password', }
  • 21. Templating strategies # manifests/init.pp class ssh ( $ports = [ 22 ], $options = {} ) { # ... file { '/etc/ssh/sshd_config': content => template('ssh/sshd_config.erb'), require => Package['openssh-server'], } # ... # Applying the class class { 'ssh': ports => [ 22, 2222 ], options => { 'PermitRootLogin' => 'no', } }
  • 22. Templating strategies # templates/sshd_config.erb # Managed by Puppet <% @ports.each do |port| %> Port <%= port %> <% end %> <% @options.each do |k,v| %> <%= k %> <%= v %> <% end %>
  • 23. Templating strategies ● Take advantage of Include conf.d/* directives file { '/etc/collectd.conf': ensure => present, content => 'Include "conf.d/*.conf"n', } # … define collectd::plugins::exec { file { "${name}.load": path => "${conf_dir}/${name}.conf", content => template('collectd/exec.conf.erb'), } }
  • 24. Beyond templates ● puppetlabs/concat concat { '/etc/motd': } concat::fragment { 'welcome': target => '/etc/motd', content => 'Welcome to Redhat', order => '01', } concat::fragment { 'legal': # … }
  • 25. Beyond templates ● puppetlabs/inifile ini_setting { 'puppetdbserver': ensure => present, section => 'main', path => "${puppet_confdir}/puppetdb.conf", setting => 'server', value => $server, } ini_setting { 'puppetdbport': # … }
  • 26. Beyond Templates ● augeas augeas { 'sshd_config_permit_root_login': context => '/files/etc/ssh/sshd_config', changes => "set PermitRootLogin $permit_root_login", require => File['/etc/ssh/sshd_config'], } ● domcleal/augeasproviders sshd_config { "PermitRootLogin": ensure => present, value => $permit_root_login, }
  • 27. Smart Parameter Defaults # manifests/params.pp class ssh::params { case $::osfamily { 'Debian': { $ssh_svc = 'ssh' } 'RedHat': { $ssh_svc = 'sshd' } default: { fail("${::osfamily} is not supported.") } } } # manifests/init.pp class ssh ( # ... ) { include ssh::params service { $ssh::params::ssh_svc: ensure => running, enable => true, } # ...
  • 29. Publishing your module metadata.json ● module name ● version (SemVer) ● author ● summary ● source ● issues URL ● operating system support ● dependencies
  • 30. Publishing your module Use semantic versioning! semver.org Major.Minor.Patch
  • 31. Publishing your module Changelog ## 2013-12-05 Release 0.10.0 ### Summary: This release adds FreeBSD osfamily support and various other improvements to some mods. ### Features: - Add suPHP_UserGroup directive to directory context - Add support for ScriptAliasMatch directives ... ## 2013-09-06 Release 0.9.0 ### Summary: ...
  • 32. Publishing your module README ● docs.puppetlabs.com/puppet/3/reference/READMEtemplate.markdown
  • 33. Publishing your module license ● choosealicense.com
  • 34. Publishing your module $ cd ssh/ $ puppet module build . $ ls pkg/ cmurphy-ssh-0.0.1 cmurphy-ssh-0.0.1.tar.gz
  • 35. Testing Why we test: ● Testing gives us (some) assurance that our code won’t break production systems ● Contributors can run tests without having the same infrastructure as you
  • 36. Testing your module ● Smoke testing # puppet apply --noop tests/init.pp
  • 37. Testing your module ● Unit testing: rspec-puppet ○ rspec-puppet.com $ bundle exec rake spec
  • 38. Testing your module # spec/classes/init_spec.rb require 'spec_helper' describe 'collectd' do let :facts do {:osfamily => 'RedHat'} end it { should contain_package('collectd').with( :ensure => 'installed' )} it { should contain_service('collectd').with( :ensure => 'running' )} # ...
  • 39. Testing your module ● Acceptance testing: beaker-rspec ○ github.com/puppetlabs/beaker ○ youtu.be/jEJmUQOlaDg $ bundle exec rspec spec/acceptance
  • 40. Testing your module # spec/acceptance/class_spec.rb require 'spec_helper_acceptance' case fact('osfamily') # ... describe 'ssh class' do context 'default parameters' do it 'should work with no errors' do pp = "class { 'ssh': }" apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true) end describe service(servicename) do it { should be_running } end # ...
  • 41. Testing your module ● Linting $ bundle exec rake lint
  • 42. Maintaining your module Update your code ● fix bugs ● add features ● manage pull requests
  • 43. Installing modules Search for modules on forge.puppetlabs.com or puppet module search ssh Then install with puppet module install saz/ssh
  • 44. Where now? Learn more at docs.puppetlabs.com/guides/module_guides/bgtm.html Get help at Ask: ask.puppetlabs.com IRC: #puppet on freenode Mailing list: groups.google.com/group/puppet-users
  • 45. Thanks! Find me: Colleen Murphy freenode: crinkle github: cmurphy twitter: @pdx_krinkle