Contenu connexe
Similaire à Creating beautiful puppet modules with puppet-lint (20)
Creating beautiful puppet modules with puppet-lint
- 7. $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
- 10. class ssh {
package {‘openssh-server’:
manifest init.pp
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_}
}
- 11. $ 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
- 13. There are two hard things in computer science:
- cache invalidation
- naming things
- off-by-one errors.
- Phil Karlton
- 14. Wrapper Module => devops/ac_mysql
Base Module => puppetlabs/mysql
http://bit.do/wrapper-class
- 17. $ puppet parser validate *.pp
$ puppet-lint *.pp
alias ppv='puppet parser validate'
alias ppl='puppet lint --no-80chars-check'