Creating beautiful puppet modules with puppet-lint
-
Upload
spencer-owen -
Category
Technology
-
view
121 -
download
0
description
Transcript of Creating beautiful puppet modules with puppet-lint
![Page 1: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/1.jpg)
Creating beautiful Puppet modules
with pupet-lint
![Page 2: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/2.jpg)
$(whoami)
![Page 4: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/4.jpg)
![Page 5: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/5.jpg)
=> Packages=> Files=> Services
![Page 6: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/6.jpg)
DSL?
I’ve got dual T1 uplinks
![Page 7: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/7.jpg)
$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
![Page 8: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/8.jpg)
$package=openssh-server
package { “$package”:
ensure => present,
}
![Page 9: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/9.jpg)
![Page 10: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/10.jpg)
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
![Page 11: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/11.jpg)
$ 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
![Page 12: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/12.jpg)
Name your puppet modules
![Page 13: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/13.jpg)
There are two hard things in computer science:
- cache invalidation- naming things- off-by-one errors.
- Phil Karlton
![Page 14: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/14.jpg)
Wrapper Module => devops/ac_mysql
Base Module => puppetlabs/mysql
http://bit.do/wrapper-class
![Page 15: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/15.jpg)
Workshop 1
https://github.com/UCPUG/ucpug-presentations
![Page 16: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/16.jpg)
Puppet-lint
![Page 17: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/17.jpg)
$ puppet parser validate *.pp$ puppet-lint *.pp
alias ppv='puppet parser validate'alias ppl='puppet lint --no-80chars-check'
![Page 18: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/18.jpg)
![Page 19: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/19.jpg)
Workshop 2
https://github.com/UCPUG/ucpug-presentations
![Page 20: Creating beautiful puppet modules with puppet-lint](https://reader035.fdocuments.net/reader035/viewer/2022062307/557c2292d8b42a65268b4f90/html5/thumbnails/20.jpg)
Questions?