Puppet Nedir?
Puppet Master ve Agent Kurulumu geçmeden önce Puppet, açık kaynak kodlu Server/Client mimarisine sahip bir Configuration Management tool’dur. Kendine ait DSL (Domain Spesifik Language) vardır. Karmaşık ve büyük sistem alt yapılarını yönetmek için kullanılabilecek araçların başında gelir.
Bu yazıda master/client kurulumu,yapılandırılması ve bir kaç örmek vermeye çalışacağım.
Server Tarafı
Sunucu üzerinde tarih ve saat bilgilerinin güncel olması için bir defaya mahsus güncelleyip ardından ntpd servisini başlatıyoruz.
1 2 3 |
# sudo ntpdate pool.ntp.org # service ntpd start # chkconfig ntpd on |
Puppet repo’sunu yüklüyoruz.
1 2 |
# yum -y install http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-12.noarch.rpm # sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/puppetlabs.repo |
Puppet server kurulumunu yapıyoruz.
1 |
# yum --enablerepo=puppetlabs-products,puppetlabs-deps -y install puppet-server |
Kurulum ardından versiyon kontrol ediyoruz.
1 2 3 |
# puppet help | tail -n 1 veya # puppet --version |
Puppet ayar dosyasında aşağıdaki ayarları kendi bilgileriniz doğrultusunda yapıyoruz.
1 2 3 4 5 |
# vim /etc/sysconfig/puppetmaster # line 2: uncomment PUPPETMASTER_MANIFEST=/etc/puppet/manifests/site.pp # line 6: uncomment PUPPETMASTER_LOG=syslog |
1 2 |
# create an empty manifest and start # touch /etc/puppet/manifests/site.pp |
1 2 |
# /etc/rc.d/init.d/puppetmaster start # chkconfig puppetmaster on |
Puupet pp uzantılı puppet scirptleri diye ifade edilen dosyaylar ile yönetilir. Yukarda varsayılan olarak manifest dosyasının site.pp olduğunu belirttik.
Agent Tarafı
1 2 3 |
# yum -y install http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-12.noarch.rpm # sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/puppetlabs.repo # yum --enablerepo=puppetlabs-products,puppetlabs-deps -y install puppet |
1 2 3 4 5 6 |
# vim /etc/sysconfig/puppet # line 2: uncomment and change to Puppet server PUPPET_SERVER=dpuppet.tazedirekt.local # line 8: uncomment PUPPET_LOG=/var/log/puppet/puppet.log |
1 2 3 |
# /etc/rc.d/init.d/puppet start Starting puppet agent: [ OK ] # chkconfig puppet on |
Master üzerinde sertifika onaylama
1 2 3 4 5 6 |
# puppet cert list "puppetagent.domain.local" (SHA256) 98:7F:92:58:EA:47:D4:AE:90:F4:8B:5E:3E:85:2E:90:FC:53:4E:6B:7B:1B:AA:96:A6:86:97:25:D5:66:C8:41 # puppet cert sign puppetagent.domain.local Notice: Signed certificate request for puppetagent.localdomain Notice: Removing file Puppet::SSL::CertificateRequest puppetagent.localdomain at '/var/lib/puppet/ssl/ca/requests/puppetagent.localdomain.pem' |
Master üzerinde sertifika silme
1 |
# puppet cert clean puppetagent.domain.local |
Test Etme
puppet master üzerinde site.pp dosyası’na, client sunucusunda tmp dizini altında example-ip isminde 644 izni ile bir dosya oluşturarak içeriğini IP Address: xxxx şeklinde oluşturan ufak bir puppet script yazdık.
1 2 3 4 5 6 |
# vim /etc/puppet/manifests/site.pp file {'/tmp/example-ip': ensure => present, mode => 0644, content => "IP Address: ${ipaddress_eth1}.\n", } |
Clinet sunucuda;
1 |
# puppet agent --test |
dediğimizde tmp altında bu dosyanın oluşmuş olması gerekiyor.
So, what do you think ?