creating beautiful puppet modules with puppet-lint
DESCRIPTION
Utah County Puppet user group Meeting on 2014-Oct-21: puppet-lintTRANSCRIPT
Creating beautiful Puppet modules
with pupet-lint
$(whoami)
=> Packages=> Files=> Services
DSL?
I’ve got dual T1 uplinks
$package=openssh-server
if [`which yum`]; then
yum install $package
elif [`which apt-get`; then
apt-get install $package
else
echo “Neither apt nor yum found”; exit 1
fi
$package=openssh-server
package { “$package”:
ensure => present,
}
class ssh { package {‘openssh-server’: ensure => present, } file {‘/etc/ssh/sshd_config’: content => ‘puppet:///ssh/sshd_config', owner => ‘root’, require => Package[‘openssh-server’], } service {‘sshd’: ensure => ‘running’, require => [Package[‘openssh-server’],File[‘/etc/ssh/ssd_config’]], }}
manifest init.pp
$ puppet module generate foo-bar$ mv foo-bar bar #bug PUP-3124$ tree bar/bar/├── README.md├── files├── manifests│ └── init.pp├── metadata.json├── spec├── templates└── tests └── init.pp
bar module layout
Name your puppet modules
There are two hard things in computer science:
- cache invalidation- naming things- off-by-one errors.
- Phil Karlton
Wrapper Module => devops/ac_mysql
Base Module => puppetlabs/mysql
http://bit.do/wrapper-class
Workshop 1
https://github.com/UCPUG/ucpug-presentations
Puppet-lint
$ puppet parser validate *.pp$ puppet-lint *.pp
alias ppv='puppet parser validate'alias ppl='puppet lint --no-80chars-check'
Workshop 2
https://github.com/UCPUG/ucpug-presentations
Questions?