Puppet seadistamine Ubuntu süsteemis: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Ttrumm (talk | contribs)
No edit summary
Ttrumm (talk | contribs)
No edit summary
Line 115: Line 115:
  include apache2
  include apache2
  }
  }
 
==Mooduli testimine puppetis==
 
puppet agent --test





Revision as of 13:56, 5 December 2011

Sissejuhatus

Käesolev juhend on mõeldud inimesele, kes oskab UNIX käsurida ja saab aru mis info paikneb /etc/hosts failis.

Juhend õpetab ja näitab kuidas installeerida ja seadistada Puppet master + kaks puppetit.

Selleks on vaja kolme masinat, millel jookseb ubuntu server.

Kõik näidetes kirjeldatud käsud käivitada administraatori õigustes.

Joonis

Paigaldamine (Ubuntu server)

Lisame read /etc/hosts faili

Need read lisame iga masina /etc/hosts faili

192.168.1.1 puppetmaster.example.com puppetmaster
192.168.1.3 puppetclient1.example.com puppetclient1
192.168.1.2 puppetclient2.example.com puppetclient2

Server / Puppetmaster

Puppetmasteri installeerimine

apt-get install puppet puppetmaster

Lubame puppet kliendid puppetmasteri failidele ligi

nano /etc/puppet/fileserver.conf

Vajadusel muudame read, et näeks välja järgmiselt:

[files]
 path /etc/puppet/files/
 allow 192.168.1.0/24
[plugins]
 allow 192.168.1.0/24

Taaskäivitame puppetmasteri

/etc/init.d/puppetmaster restart

Klient / Puppet

Puppet kliendi installeerimine

sudo apt-get   install puppet

Muudame faili etc/puppet/puppet.conf

nano etc/puppet/puppet.conf

Vajadusel muudame read, et näeks välja järgmiselt:

[main]
 logdir=/var/log/puppet
 vardir=/var/lib/puppet
 ssldir=/var/lib/puppet/ssl
 rundir=/var/run/puppet
 factpath=$vardir/lib/facter
 pluginsync=true
[puppetmasterd]
 templatedir=/var/lib/puppet/templates

Lubame puppetil käivituda automaatselt

nano /etc/default/puppet 

Vajadusel muudame

START=yes

Taaskäivitame puppeti

/etc/init.d/puppet restart

Puppetite lisamine puppetmasterisse

Puppet klient

Puppetmasterist sertifikaadi küsimiseks, käivitame käsu:

puppetd --server puppetmaster.example.com --waitforcert 60

Puppetmasteris

Vaatame kes ootab sertifikaati

puppetca -la

Puppetile sertifikaadi andmine

puppetca --sign puppetclient1.example.com
puppetca --sign puppetclient2.example.com

Puppet mooduli loomine

Puppetmasterisse saab luua moodulid ja neid ka puppetitele määrata.

See juhend õpetab ja näitab kuidas lisada puppetitele apache2

Puppetmasteri seadistamine

Loome site.pp faili

nano /etc/puppet/manifests/site.pp

Lisame read

import "modules"
import "nodes"

Defineerime noded

nano /etc/puppet/manifests/site.pp

Lisame read

node basenode {
}
node 'puppet1.example.com' inherits basenode {
}
node 'puppet2.example.com' inherits basenode {
}

Mooduli loomine

Loome kausta mooduli nimega

mkdir /etc/puppet/modules/apache2

Loome kausta manifests

mkdir /etc/puppet/modules/apache2/manifests

Loome init.pp faili

touch /etc/puppet/modules/apache2/manifests/init.pp

Muudame init.pp faili

nano /etc/puppet/modules/apache2/manifests/init.pp

Lisame read

 class apache2{
    package {
    'apache2':
    ensure => installed
  }
 }

Lisame mooduli puppetitele

nano /etc/puppet/manifests/site.pp

Muudame vastavalt

node 'puppet1.example.com' inherits basenode {
include apache2
}
node 'puppet2.example.com' inherits basenode {
include apache2
}

Mooduli testimine puppetis

puppet agent --test