First, I wrote this article to record my learning history and share it with others. I hope to provide better suggestions and help me improve my learning experience.
1. Because managing puppet requires DNS configuration, I will not introduce it too much here.
2. For certificate authentication between puppetmaster and puppetclient, I will not introduce it too much here. Next I will go to the topic.
Debian)
First, you need to change the configuration files in puppetmaster.
First, go to the puppet directory:
/Etc/puppet/fileserver. conf
[files] path /etc/puppet allow *.supcorp.lan# deny *.evil.example.com# allow 192.168.0.0/24[plugins] allow *.supcorp.lan# deny *.evil.example.com# allow 192.168.0.0/24
In this way, our puppetmaster can be used as a file server.
The following is the template I created, which is written in etc \ puppet \ modules \ drbd \ manifests \ init. pp.
Create a drbd class drbd {ensure that the installation package of the drbd package {'drbd-utils': Ensure => installed} is enabled to ensure that the drbd Service {'drbd ': ensure => running, enable => true, hasstatus => false, hasrestart => true, require => package ['drbd-utils ']} file {mode => '123', owner => 'root', group => 'root ', require => package ['drbd-utils']} file {'/etc/drbd. d': Ensure => directory, mode => '000000', purge => true, require => package ['drbd-utils ']} file {'/etc/drbd. d/first-storage.res ': content => template ("drbd/first-storage.res.erb"), require => service ['drbd']} file {'/etc/drbd. d/second-storage.res ': content => template ("drbd/second-storage.res.erb"), require => service ['drbd']} exec {Path => ["/usr/bin ", "/usr/sbin", "/bin", "/sbin"],} exec {"drbdadm create-MD $ {storage }": command => "drbdadm create-MD $ {storage}", refreshonly => true, subscribe => file ["/etc/drbd. d/$ {storage }. res "], require => file ["/etc/drbd. d/$ {storage }. res "]} exec {" drbdadm up $ {storage} ": command =>" drbdadm up $ {storage} ", refreshonly => true, subscribe => exec ["drbdadm create-MD $ {storage}"], require => file ["/etc/drbd. d/$ {storage }. res "]} exec {'drbd _ make_primary ': command =>" drbdadm -- overwrite-data-of-peer primary all ", refreshonly => true, subscribe => exec ["drbdadm up $ {storage}"], require => service ['drbd ']} exec {'drbdadm secondary all ': command => "drbdadm secondary all", refreshonly => true, subscribe => service ['drbd '], before => exec ['drbd _ make_primary ']} exec {"drbdadm primary -- Force $ {storage}": command => "drbdadm primary -- Force $ {storage }", require => package ['drbd-utils']} exec {"mkfs. ext3 $ {Dev} ": command =>" mkfs. ext3 $ {Dev} ", Path => ["/usr/bin ","/usr/sbin ","/bin ","/sbin "], require => exec ["drbdadm primary -- Force $ {storage}"]}
Puppet: A New drbd experience