SlideShare a Scribd company logo
Intro to PDK
Steven Pritchard
Onyx Point
Welcome to Intro to PDK!
System Integrity Management Platform (SIMP) Open Source stewards
DevOps, Compliance, and Automation consulting
Professional services for SIMP, Puppet, Red Hat®, and GitLab
Puppet Gold Partners
Steven Pritchard
Senior Consultant
Puppet Certified Professional (2017)
Linux and Open Source geek for over 20 years
Southern Illinois Linux Users Group
Vim Geeks
What is PDK?
The Puppet Development Kit (PDK) is an All‑In‑One set of tools for developing and testing Puppet
modules.
PDK includes a bundled version of Ruby plus various gems and utilities required for creating and
testing Puppet modules.
PDK was announced in August of 2017 with the goal of making it easier to build high‑quality
Puppet modules that follow best practices and use the available testing frameworks to avoid
deploying bad code to live infrastructure.
Installation
PDK packages for various Linux distributions, Windows, and MacOS X can be downloaded from
https://puppet.com/download‑puppet‑development‑kit.
https://puppet.com/docs/pdk/latest/pdk.html
Creating a Module - The Old Way
$ puppet module generate author-modulename --skip-interview
$ cd modulename
...Lots of editing...
$ puppet module build
...Upload to Forge...
What's Wrong With the Old Way?
Module skeleton quality varied wildly.
Often easier to create everything from scratch.
The skeleton was only used as an initial template.
puppet module generate was deprecated in Puppet 5.4.0.
Creating a Module - The New Way
$ pdk new module author-modulename
$ cd modulename
$ pdk new class modulename
...Lots of editing...
$ pdk validate
$ pdk test unit
$ pdk build
...Upload to Forge...
Why is this better?
Generated code follows best practices.
pdk new class classname creates manifests/classname.pp and
spec/classes/classname_spec.rb.
Testing out of the box!
The default templates (https://github.com/puppetlabs/pdk‑templates) include lots of
goodies:
CI configurations for Travis CI, GitLab CI/CD, and AppVeyor
operatingsystem_support and requirements in metadata.json
Git configuration (.gitignore, .gitattributes)
Puppet Strings in generated code
Updates to the templates can be applied to (some files in) the module.
Interaction with Ruby tooling ( bundle , rake ) is not required.
Did I mention that puppet module generate was deprecated in Puppet 5.4.0?
Using PDK
Create a new module
$ pdk new module mynewmodule
(Or you can skip the interview...)
$ pdk new module mynewmodule --skip-interview
Convert an existing module to PDK format
$ pdk convert
(Note that this does not add tests for existing classes, defined types, etc.)
Update from the templates in an existing PDK-format module
$ pdk update
Using PDK
Create a new class
$ pdk new class classname
Create a new defined type
$ pdk new defined_type typename
Create a new task
$ pdk new task taskname
Testing
Smoke tests (simple lint , rubocop , and parser checks) can be run with the following command:
$ pdk validate
Unit tests (Ruby scripts that use rspec‑puppet to test the contents of a compiled catalog) can be
executed with the following command:
$ pdk test unit
The default tests use rspec‑puppet‑facts to test catalog compilation on each supported OS.
https://puppet.com/docs/pdk/1.x/pdk_testing.html
pdk bundle
PDK allows you to run arbitrary bundle commands with pdk bundle . For example, to see what
rake tasks are available, you can run the following command:
$ pdk bundle exec rake -- -T
To see all output of the rake tasks run by pdk test unit , you can run the following command:
$ pdk bundle exec rake spec
Acceptance Tests
Acceptance tests spin up VMs or Docker containers to test the behavior of a module on a live
system.
PDK currently has no direct support for acceptance tests, but if you have an existing module with
working tests, you should be able to make some minor additions to Gemfile and run the
following:
$ pdk bundle exec rake beaker
For more information on acceptance tests, see the following:
beaker‑rspec
beaker
Serverspec
PDK Templates
The default PDK templates can be found here:
https://github.com/puppetlabs/pdk‑templates
Files in the moduleroot_init directory are created only if they don't exist.
Files in the moduleroot directory will replace any existing file when you run pdk update or pdk
convert .
Files in the object_templates directory are used by the various pdk new commands.
The default settings for the template output can be found in the file config_defaults.yml.
Customizing Template Output
Settings in the file .sync.yml in the root of your module can be used to customize the output of
the templates.
.sync.yml contains a hash. The keys of the hash are the names of the generated files. The exact
values can be found by looking at the PDK templates README.md, config_defaults.yml in the
templates, and the code of the templates.
After updating .sync.yml, run pdk update to regenerate files from the templates.
Example .sync.yml
---
Gemfile:
optional:
':acceptance':
- gem: beaker
- gem: beaker-rspec
- gem: beaker-puppet_install_helper
- gem: beaker-module_install_helper
- gem: vagrant-wrapper
.gitignore:
paths:
- /update_report.txt
spec/spec_helper.rb:
spec_overrides: |-
# Add coverage report.
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!
end
end
Future of PDK
PDK has experimental support for creating a new provider with pdk new provider . See
https://github.com/puppetlabs/puppet‑resource_api#getting‑started for more information.
Other interesting features that may be coming soon:
More module features
pdk new function PDK‑700
pdk new fact PDK‑683
Multi‑Puppet Support PDK‑414
Support for additional platforms PDK‑399
Testing on multiple Puppet and Ruby versions PDK‑785, PDK‑840, etc.
Data in modules by default PDK‑908
CLI ability to update metadata.json PDK‑878
Improved CI/CD support PDK‑477
Control repo support PDK‑564, puppetlabs/pdk#333
Bundled git support
For More Information...
PDK
https://puppet.com/download‑puppet‑development‑kit
Onyx Point
https://onyxpoint.com/
https://simp‑project.com/
Me
https://twitter.com/silug
https://github.com/silug

More Related Content

PPTX
Android presentation - Gradle ++
PDF
Gradle Introduction
PPTX
Gradle,the new build system for android
PPT
Ese 2008 RTSC Draft1
PDF
Gradle
PDF
Architecting The Future - WeRise Women in Technology
PPTX
MPL: modular pipeline library - Dynamic Talks Milwaukee 4/11/2019
PPTX
Js tacktalk team dev js testing performance
Android presentation - Gradle ++
Gradle Introduction
Gradle,the new build system for android
Ese 2008 RTSC Draft1
Gradle
Architecting The Future - WeRise Women in Technology
MPL: modular pipeline library - Dynamic Talks Milwaukee 4/11/2019
Js tacktalk team dev js testing performance

What's hot (20)

PDF
PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...
PDF
Introduction to Tekton
PDF
Debugging Python with gdb
PPTX
How to lock a Python in a cage? Managing Python environment inside an R project
PDF
Managing large scale projects in R with R Suite
PDF
Idiomatic gradle plugin writing
PDF
What's new in python 3.8? | Python 3.8 New Features | Edureka
PDF
PDF
Tekton showcase - CDF Summit Kubecon Barcelona 2019
PDF
[DEPRECATED]Gradle the android
PDF
Cloud-Native CI/CD on Kubernetes with Tekton Pipelines
PPT
Moving applications to HDF5 1.8
PDF
PGConf.ASIA 2019 Bali - Patroni on GitLab.com - Jose Cores Finnoto
PDF
[Global logic] container runtimes and kubernetes
PPTX
PDF
MultiQC: summarize analysis results for multiple tools and samples in a singl...
PPTX
JSX Optimizer
PDF
Multiplatform Apps with Spring, Kotlin, and RSocket
PDF
Openshift cheat rhce_r3v1 rhce
PDF
Build microservice with gRPC in golang
PuppetConf 2017: Puppet Development Kit: A Seamless Workflow for Module Devel...
Introduction to Tekton
Debugging Python with gdb
How to lock a Python in a cage? Managing Python environment inside an R project
Managing large scale projects in R with R Suite
Idiomatic gradle plugin writing
What's new in python 3.8? | Python 3.8 New Features | Edureka
Tekton showcase - CDF Summit Kubecon Barcelona 2019
[DEPRECATED]Gradle the android
Cloud-Native CI/CD on Kubernetes with Tekton Pipelines
Moving applications to HDF5 1.8
PGConf.ASIA 2019 Bali - Patroni on GitLab.com - Jose Cores Finnoto
[Global logic] container runtimes and kubernetes
MultiQC: summarize analysis results for multiple tools and samples in a singl...
JSX Optimizer
Multiplatform Apps with Spring, Kotlin, and RSocket
Openshift cheat rhce_r3v1 rhce
Build microservice with gRPC in golang
Ad

Similar to Intro to PDK (20)

PDF
Puppet camp2021 testing modules and controlrepo
PDF
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PDF
Lean Drupal Repositories with Composer and Drush
PDF
Pharo GitLab Example: This is a simple Pharo Smalltalk pipeline example
PDF
ICONUK 2015 - Gradle Up!
KEY
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
PDF
Puppet Systems Infrastructure Construction Kit
PDF
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
ODP
Drupal Best Practices
PDF
Packaging perl (LPW2010)
PDF
Gradle - the Enterprise Automation Tool
PDF
Introduction to package manager
PDF
Drupal 8 improvements for developer productivity php symfony and more
ODP
30 Minutes To CPAN
PDF
A New Chapter of Data Processing with CDK
PPTX
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
PDF
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
PDF
Build and Distributing SDK Add-Ons
PDF
Introduction to gradle
RTF
Readme
Puppet camp2021 testing modules and controlrepo
PuppetCamp2021-Testing Modules and ControlRepo.pdf
Lean Drupal Repositories with Composer and Drush
Pharo GitLab Example: This is a simple Pharo Smalltalk pipeline example
ICONUK 2015 - Gradle Up!
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet Systems Infrastructure Construction Kit
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Drupal Best Practices
Packaging perl (LPW2010)
Gradle - the Enterprise Automation Tool
Introduction to package manager
Drupal 8 improvements for developer productivity php symfony and more
30 Minutes To CPAN
A New Chapter of Data Processing with CDK
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Build and Distributing SDK Add-Ons
Introduction to gradle
Readme
Ad

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Digital Strategies for Manufacturing Companies
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
System and Network Administration Chapter 2
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
L1 - Introduction to python Backend.pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administraation Chapter 3
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
top salesforce developer skills in 2025.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Odoo POS Development Services by CandidRoot Solutions
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Digital Strategies for Manufacturing Companies
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
System and Network Administration Chapter 2
Understanding Forklifts - TECH EHS Solution
CHAPTER 2 - PM Management and IT Context
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
history of c programming in notes for students .pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
L1 - Introduction to python Backend.pptx
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administraation Chapter 3
Navsoft: AI-Powered Business Solutions & Custom Software Development
top salesforce developer skills in 2025.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Odoo POS Development Services by CandidRoot Solutions

Intro to PDK

  • 1. Intro to PDK Steven Pritchard Onyx Point
  • 2. Welcome to Intro to PDK! System Integrity Management Platform (SIMP) Open Source stewards DevOps, Compliance, and Automation consulting Professional services for SIMP, Puppet, Red Hat®, and GitLab Puppet Gold Partners Steven Pritchard Senior Consultant Puppet Certified Professional (2017) Linux and Open Source geek for over 20 years Southern Illinois Linux Users Group Vim Geeks
  • 3. What is PDK? The Puppet Development Kit (PDK) is an All‑In‑One set of tools for developing and testing Puppet modules. PDK includes a bundled version of Ruby plus various gems and utilities required for creating and testing Puppet modules. PDK was announced in August of 2017 with the goal of making it easier to build high‑quality Puppet modules that follow best practices and use the available testing frameworks to avoid deploying bad code to live infrastructure.
  • 4. Installation PDK packages for various Linux distributions, Windows, and MacOS X can be downloaded from https://puppet.com/download‑puppet‑development‑kit. https://puppet.com/docs/pdk/latest/pdk.html
  • 5. Creating a Module - The Old Way $ puppet module generate author-modulename --skip-interview $ cd modulename ...Lots of editing... $ puppet module build ...Upload to Forge...
  • 6. What's Wrong With the Old Way? Module skeleton quality varied wildly. Often easier to create everything from scratch. The skeleton was only used as an initial template. puppet module generate was deprecated in Puppet 5.4.0.
  • 7. Creating a Module - The New Way $ pdk new module author-modulename $ cd modulename $ pdk new class modulename ...Lots of editing... $ pdk validate $ pdk test unit $ pdk build ...Upload to Forge...
  • 8. Why is this better? Generated code follows best practices. pdk new class classname creates manifests/classname.pp and spec/classes/classname_spec.rb. Testing out of the box! The default templates (https://github.com/puppetlabs/pdk‑templates) include lots of goodies: CI configurations for Travis CI, GitLab CI/CD, and AppVeyor operatingsystem_support and requirements in metadata.json Git configuration (.gitignore, .gitattributes) Puppet Strings in generated code Updates to the templates can be applied to (some files in) the module. Interaction with Ruby tooling ( bundle , rake ) is not required. Did I mention that puppet module generate was deprecated in Puppet 5.4.0?
  • 9. Using PDK Create a new module $ pdk new module mynewmodule (Or you can skip the interview...) $ pdk new module mynewmodule --skip-interview Convert an existing module to PDK format $ pdk convert (Note that this does not add tests for existing classes, defined types, etc.) Update from the templates in an existing PDK-format module $ pdk update
  • 10. Using PDK Create a new class $ pdk new class classname Create a new defined type $ pdk new defined_type typename Create a new task $ pdk new task taskname
  • 11. Testing Smoke tests (simple lint , rubocop , and parser checks) can be run with the following command: $ pdk validate Unit tests (Ruby scripts that use rspec‑puppet to test the contents of a compiled catalog) can be executed with the following command: $ pdk test unit The default tests use rspec‑puppet‑facts to test catalog compilation on each supported OS. https://puppet.com/docs/pdk/1.x/pdk_testing.html
  • 12. pdk bundle PDK allows you to run arbitrary bundle commands with pdk bundle . For example, to see what rake tasks are available, you can run the following command: $ pdk bundle exec rake -- -T To see all output of the rake tasks run by pdk test unit , you can run the following command: $ pdk bundle exec rake spec
  • 13. Acceptance Tests Acceptance tests spin up VMs or Docker containers to test the behavior of a module on a live system. PDK currently has no direct support for acceptance tests, but if you have an existing module with working tests, you should be able to make some minor additions to Gemfile and run the following: $ pdk bundle exec rake beaker For more information on acceptance tests, see the following: beaker‑rspec beaker Serverspec
  • 14. PDK Templates The default PDK templates can be found here: https://github.com/puppetlabs/pdk‑templates Files in the moduleroot_init directory are created only if they don't exist. Files in the moduleroot directory will replace any existing file when you run pdk update or pdk convert . Files in the object_templates directory are used by the various pdk new commands. The default settings for the template output can be found in the file config_defaults.yml.
  • 15. Customizing Template Output Settings in the file .sync.yml in the root of your module can be used to customize the output of the templates. .sync.yml contains a hash. The keys of the hash are the names of the generated files. The exact values can be found by looking at the PDK templates README.md, config_defaults.yml in the templates, and the code of the templates. After updating .sync.yml, run pdk update to regenerate files from the templates.
  • 16. Example .sync.yml --- Gemfile: optional: ':acceptance': - gem: beaker - gem: beaker-rspec - gem: beaker-puppet_install_helper - gem: beaker-module_install_helper - gem: vagrant-wrapper .gitignore: paths: - /update_report.txt spec/spec_helper.rb: spec_overrides: |- # Add coverage report. RSpec.configure do |c| c.after(:suite) do RSpec::Puppet::Coverage.report! end end
  • 17. Future of PDK PDK has experimental support for creating a new provider with pdk new provider . See https://github.com/puppetlabs/puppet‑resource_api#getting‑started for more information. Other interesting features that may be coming soon: More module features pdk new function PDK‑700 pdk new fact PDK‑683 Multi‑Puppet Support PDK‑414 Support for additional platforms PDK‑399 Testing on multiple Puppet and Ruby versions PDK‑785, PDK‑840, etc. Data in modules by default PDK‑908 CLI ability to update metadata.json PDK‑878 Improved CI/CD support PDK‑477 Control repo support PDK‑564, puppetlabs/pdk#333 Bundled git support
  • 18. For More Information... PDK https://puppet.com/download‑puppet‑development‑kit Onyx Point https://onyxpoint.com/ https://simp‑project.com/ Me https://twitter.com/silug https://github.com/silug