SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
Writing and Publishing
Puppet Modules
Colleen Murphy, Portland State University
Hello
This is a beginner’s approach.
Hello
PSU’s College of Engineering’s IT department,
aka The Computer Action Team (TheCAT),
uses puppet to manage a diverse infrastructure.
github.com/pdxcat
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
➔ 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
➔ lib/ # plugins: types and providers, functions,
| facts, etc
➔ tests/ # smoke tests/example usage
➔ spec/ # automated tests
Starting out
$ puppet module generate cmurphy-ssh && mv cmurphy-ssh ssh
Generating module at /etc/puppet/modules/cmurphy-ssh
cmurphy-ssh
cmurphy-ssh/manifests
cmurphy-ssh/manifests/init.pp
cmurphy-ssh/spec
cmurphy-ssh/spec/spec_helper.rb
cmurphy-ssh/tests
cmurphy-ssh/tests/init.pp
cmurphy-ssh/README
cmurphy-ssh/Modulefile
$ mkdir ssh/{files,templates}
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'],
}
}
# tests/init.pp
include ssh
# or
# /etc/puppet/manifests/site.pp
node default {
include ssh
}
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
# ...
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'],
}
# ...
# Applying the class
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
Working with tricky configuration files
● Take advantage of Include conf/* 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
● domcleal/augeasproviders
augeas { 'sshd_config_permit_root_login':
context => '/files/etc/ssh/sshd_config',
changes => "set PermitRootLogin $permit_root_login",
require => File['/etc/ssh/sshd_config'],
}
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
Modulefile
name 'cmurphy-ssh'
version '0.0.1'
source 'https://github.com/cmurphy/puppet-module-ssh.git'
author 'Colleen Murphy'
license 'Apache License, Version 2.0'
summary 'Puppet module for ssh'
description 'Demonstration of parameterized ssh module'
project_page 'https://github.com/cmurphy/puppet-module-ssh'
## Add dependencies, if any:
# dependency 'username/name', '>= 1.2.0'
Publishing your module
README
● docs.puppetlabs.com/puppet/3/reference/READMEtemplate.markdown
license
● choosealicense.com
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
Use semantic versioning!
semver.org
Major.Minor.Patch
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': }"
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => 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
Then install with
puppet module install
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

Mais conteúdo relacionado

Mais procurados

Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next levelAlessandro Franceschi
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien pauli
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTSjulien pauli
 
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...Ritta Narita
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshopjulien pauli
 
How PHP Works ?
How PHP Works ?How PHP Works ?
How PHP Works ?Ravi Raj
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life CycleXinchen Hui
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionjulien pauli
 
Understanding PHP memory
Understanding PHP memoryUnderstanding PHP memory
Understanding PHP memoryjulien pauli
 
PHP 7 OPCache extension review
PHP 7 OPCache extension reviewPHP 7 OPCache extension review
PHP 7 OPCache extension reviewjulien pauli
 
Learning puppet chapter 3
Learning puppet chapter 3Learning puppet chapter 3
Learning puppet chapter 3Vishal Biyani
 
Using Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXUsing Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXPuppet
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugDavid Golden
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Puppet
 
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
 

Mais procurados (19)

Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next level
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny Puppet
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTS
 
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...
How to create multiprocess server on windows with ruby - rubykaigi2016 Ritta ...
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
How PHP Works ?
How PHP Works ?How PHP Works ?
How PHP Works ?
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life Cycle
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extension
 
Understanding PHP memory
Understanding PHP memoryUnderstanding PHP memory
Understanding PHP memory
 
PHP 7 OPCache extension review
PHP 7 OPCache extension reviewPHP 7 OPCache extension review
PHP 7 OPCache extension review
 
Learning puppet chapter 3
Learning puppet chapter 3Learning puppet chapter 3
Learning puppet chapter 3
 
Using Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXUsing Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSX
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014
 
PHP 7 new engine
PHP 7 new enginePHP 7 new engine
PHP 7 new engine
 
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 ...
 

Semelhante a Portland Puppet User Group June 2014: Writing and publishing puppet modules

Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Puppet
 
Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet ModulesPuppet
 
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
 
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
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesPuppet
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakNETWAYS
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with PuppetJoe Ray
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHDavid Stockton
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonPuppet
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developerssagarhere4u
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDDSudar Muthu
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)dantleech
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using SwiftDiego Freniche Brito
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 

Semelhante a Portland Puppet User Group June 2014: Writing and publishing puppet modules (20)

Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
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 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
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
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
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large Enterprises
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developers
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 

Mais de 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
 

Mais de 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
 

Último

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Último (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Portland Puppet User Group June 2014: Writing and publishing puppet modules

  • 1. Writing and Publishing Puppet Modules Colleen Murphy, Portland State University
  • 2. Hello This is a beginner’s approach.
  • 3. Hello PSU’s College of Engineering’s IT department, aka The Computer Action Team (TheCAT), uses puppet to manage a diverse infrastructure. github.com/pdxcat
  • 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 ➔ lib/ # plugins: types and providers, functions, | facts, etc ➔ tests/ # smoke tests/example usage ➔ spec/ # automated tests
  • 9. 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
  • 10. Starting out $ puppet module generate cmurphy-ssh && mv cmurphy-ssh ssh Generating module at /etc/puppet/modules/cmurphy-ssh cmurphy-ssh cmurphy-ssh/manifests cmurphy-ssh/manifests/init.pp cmurphy-ssh/spec cmurphy-ssh/spec/spec_helper.rb cmurphy-ssh/tests cmurphy-ssh/tests/init.pp cmurphy-ssh/README cmurphy-ssh/Modulefile $ mkdir ssh/{files,templates}
  • 11. 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'], } } # tests/init.pp include ssh # or # /etc/puppet/manifests/site.pp node default { include ssh }
  • 12. 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 # ...
  • 13. Needs more portability! No one should have to change your code or your files in order to use your module.
  • 14. 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 # ...
  • 15. 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'], } # ... # Applying the class class { 'ssh': permit_root_login => 'without-password', }
  • 16. 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', } }
  • 17. Templating strategies # templates/sshd_config.erb # Managed by Puppet <% @ports.each do |port| %> Port <%= port %> <% end %> <% @options.each do |k,v| %> <%= k %> <%= v %> <% end %>
  • 18. Templating strategies Working with tricky configuration files ● Take advantage of Include conf/* 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'), } }
  • 19. Beyond templates ● puppetlabs/concat concat { '/etc/motd': } concat::fragment { 'welcome': target => '/etc/motd', content => 'Welcome to Redhat', order => '01', } concat::fragment { 'legal': # … }
  • 20. Beyond templates ● puppetlabs/inifile ini_setting { 'puppetdbserver': ensure => present, section => 'main', path => "${puppet_confdir}/puppetdb.conf", setting => 'server', value => $server, } ini_setting { 'puppetdbport': # … }
  • 21. Beyond Templates ● augeas ● domcleal/augeasproviders augeas { 'sshd_config_permit_root_login': context => '/files/etc/ssh/sshd_config', changes => "set PermitRootLogin $permit_root_login", require => File['/etc/ssh/sshd_config'], } sshd_config { "PermitRootLogin": ensure => present, value => $permit_root_login, }
  • 22. 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, } # ...
  • 24. Publishing your module Modulefile name 'cmurphy-ssh' version '0.0.1' source 'https://github.com/cmurphy/puppet-module-ssh.git' author 'Colleen Murphy' license 'Apache License, Version 2.0' summary 'Puppet module for ssh' description 'Demonstration of parameterized ssh module' project_page 'https://github.com/cmurphy/puppet-module-ssh' ## Add dependencies, if any: # dependency 'username/name', '>= 1.2.0'
  • 25. Publishing your module README ● docs.puppetlabs.com/puppet/3/reference/READMEtemplate.markdown license ● choosealicense.com
  • 26. 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: ...
  • 27. Publishing your module Use semantic versioning! semver.org Major.Minor.Patch
  • 28. Publishing your module $ cd ssh/ $ puppet module build . $ ls pkg/ cmurphy-ssh-0.0.1 cmurphy-ssh-0.0.1.tar.gz
  • 29. 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
  • 30. Testing your module ● Smoke testing # puppet apply --noop tests/init.pp
  • 31. Testing your module ● Unit testing: rspec-puppet ○ rspec-puppet.com $ bundle exec rake spec
  • 32. 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' )} # ...
  • 33. Testing your module ● Acceptance testing: beaker-rspec ○ github.com/puppetlabs/beaker ○ youtu.be/jEJmUQOlaDg $ bundle exec rspec spec/acceptance
  • 34. 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': }" # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_failures => true) end describe service(servicename) do it { should be_running } end # ...
  • 35. Testing your module ● Linting $ bundle exec rake lint
  • 36. Maintaining your module Update your code ● fix bugs ● add features ● manage pull requests
  • 37. Installing modules Search for modules on forge.puppetlabs.com or puppet module search Then install with puppet module install
  • 38. 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
  • 39. Thanks! Find me: Colleen Murphy freenode: crinkle github: cmurphy twitter: @pdx_krinkle