Upload
yuu-yamanaka
View
194
Download
0
Embed Size (px)
DESCRIPTION
I've made a 5 mins LT with this slides on 2014/11/21 in HDE, Inc.
Citation preview
HDE, Inc. SEG dept.Yuu Yamanaka
Chef Puppet
An engineer of SEG dept. DevOps unit
(6 years career in HDE)
Yuu Yamanaka
Chef PuppetBefore explaining that,
Puppet
We have started to use Puppet from 2012/04
At the time, Chef was not popular and proven than Puppet
We were not Rubyist but Pythonista
(Of course, both Puppet and Chef are made by Ruby)
Can not apply a part of manifests to a node
Have to write all dependencies for each resources
Own and wordy syntax
Puppet
But some points stressed us…
knife-solo make it possible to test recipes speedy and easily
You also can assemble recipes by Role(cook –o role[base])
$ knife solo cook -o recipe[hdeone] srv1.example.com
Puppetpackage { 'ganglia-gmond':
ensure => latest,}
service { 'gmond':ensure => running,enable => true,hasstatus => true,hasrestart => true,require => Package['ganglia-gmond'],
}file { '/etc/ganglia/gmond.conf':
ensure => file,content => template(“path/to/gmond.conf.erb”),require => Package['ganglia-gmond'],notify => Service['gmond'],
}
Chef
package 'ganglia-gmond'
template '/etc/ganglia/gmond.conf' donotifies :restart, 'service[gmond]'
end
service 'gmond' dosupports :status => true, :restart => true, :reload => trueaction [:start, :enable]
end
Just recognized by order
and we often forget to specify…
ephemerals = node['ec2'].select { |k, _|k.start_with?('block_device_mapping_ephemeral')
} .map { |k, v| [k.split('_').last, "/dev/#{v}"] }
ephemerals.each { |name, device_path|execute 'mkfs' do
command "mkfs -t #{node['ec2']['ephemeral']['fstype']} #{device_path}"
not_if "grep -qs #{device_path} /proc/mounts"end
mount_point = "/media/#{name}"directory mount_point # create mount point
mount mount_point dodevice device_pathfstype node['ec2']['ephemeral']['fstype']action [:mount, :enable]
end}
%w(main.cf master.cf).each do |conf|template "/etc/postfix/#{conf}" do
notifies :restart, 'service[postfix]'end
end
We are learning Ruby syntax when writing recipes
It is a simple reason.
We would like to use a better tool.
Chef Puppet
Stay CreativeLive Comfortably
(from DevOps Unit's creed)
END