2. mod·ule
(mŏj′o͞ol) n.
1. A standardized, often interchangeable component of a system or
construction that is designed for easy assembly or flexible use
2 / 46
4. Trifecta Package: Managing a package by enforcing it's state
File: Managing a configuration file or it's content
Service: Managing a service or daemon
Where We Typically Start
4 / 46
24. Functions
Be Flexible
human boolean
class{'foobar':
service_enable='t',
}
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: "t" is not
a boolean. It looks to be a String
str2bool.rb
#Strict
validate_bool($service_enable)
#Relaxed
$bool_service_enable=str2bool($service_enable)
str2bool converts human booleans
when/^(1|t|y|true|yes)$/ thentrue
when/^(0|f|n|false|no)$/ thenfalse
PuppetLabs StdLib
https://forge.puppetlabs.com/puppetlabs/stdlib
24 / 46
25. Functions
Be Flexible
human boolean
class{'foobar':
service_enable='t',
}
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: "t" is not
a boolean. It looks to be a String
str2bool.rb
#Strict
validate_bool($service_enable)
#Relaxed
$bool_service_enable=str2bool($service_enable)
str2bool converts human booleans
when/^(1|t|y|true|yes)$/ thentrue
when/^(0|f|n|false|no)$/ thenfalse
PuppetLabs StdLib
https://forge.puppetlabs.com/puppetlabs/stdlib
###ValidationofParameters
validate_absolute_path($standardFu::config_file_path)
validate_absolute_path($standardFu::config_dir_path)
validate_string($standardFu::config_file_owner)
validate_string($standardFu::config_file_group)
validate_string($standardFu::config_file_mode)
#SanitizeBooleans
$bool_config_dir_purge=str2bool($standardFu::config_dir_purge)
$bool_service_enable =str2bool($standardFu::service_enable)
25 / 46
31. Semantic Versioning
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible
manner, and
PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as
extensions to the MAJOR.MINOR.PATCH format.
http://www.semver.org
31 / 46
40. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
40 / 46
41. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
Data Separation
41 / 46
42. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
Data Separation
Choices in how to manage module resources
42 / 46
43. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
Data Separation
Choices in how to manage module resources
Decommissioning of Single Resources
43 / 46
44. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
Data Separation
Choices in how to manage module resources
Decommissioning of Single Resources
Decommissioning of the Entire module
44 / 46
45. Basic Foobar: What we changed
Module Documentation
Standard Naming Convention
Data Separation
Choices in how to manage module resources
Decommissioning of Single Resources
Decommissioning of the Entire module
Dry Run support
45 / 46
46. Thank You For Listening
Questions?
please see vendor for rotten throwing tomatoes!
46 / 46