Puppet seadistamine Ubuntu süsteemis: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Ttrumm (talk | contribs)
Ttrumm (talk | contribs)
No edit summary
Line 80: Line 80:
  |
  |
  |-modules---|-apache2--------------|-manifests-|-init.pp
  |-modules---|-apache2--------------|-manifests-|-init.pp
                                     |
                                      


==Puppetmasteri seadistamine==
==Puppetmasteri seadistamine==
===Loome site.pp faili ===
===Loome puppeti jaoks vajalikud failid ===
  nano /etc/puppet/manifests/site.pp
  touch /etc/puppet/manifests/site.pp
Lisame read
touch /etc/puppet/manifests/nodes.pp
  import "modules"
touch /etc/puppet/manifests/modules.pp
  import "nodes"
==Loome apache 2 mooduli jaoks vajalikud kaustad ja failid==
===Defineerime noded===
  mkdir -p /etc/puppet/modules/apache2/manifests
  nano /etc/puppet/manifests/site.pp
  touch /etc/puppet/modules/apache2/manifests/init.pp
 
==Loome noded==
Selleks muudame faili nodes.pp
  nano /etc/puppet/manifests/nodes.pp
Lisame read
Lisame read
  node basenode {
  nodes basenode {
}
  include apache2
node 'puppetclient1.example.com ' inherits basenode {
  }  
}
node 'puppetclient2.example.com ' inherits basenode {
  }


==Mooduli loomine==
==Mooduli loomine==
Loome kausta mooduli nimega
Muudame apache2 init.pp faili
mkdir -p /etc/puppet/modules/apache2
Loome kausta manifests
mkdir -p /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
  nano /etc/puppet/modules/apache2/manifests/init.pp
Lisame read
Lisame read
Line 113: Line 108:
     'apache2':
     'apache2':
     ensure => installed
     ensure => installed
  }
    }
  }
  }
</source>
</source>
Lisame mooduli puppetitele
==Lisame apache2 mooduli puppeti moodulisse==
  nano /etc/puppet/manifests/site.pp
Lisame puppeti modules.pp faili vajalikud read:
Muudame vastavalt
  nano /etc/puppet/manifests/modules.pp
node basenode {
  import "apache2"
include apache2
 
}
==Muudame site.pp faili==
node 'puppetclient1.example.com ' inherits basenode {
Lisame rea:
}
  import "nodes"
node 'ppuppetclient2.example.com ' inherits basenode {
  }


==Puppetmasteri taaskäivitamine==
==Puppetmasteri taaskäivitamine==

Revision as of 13:56, 8 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

Puppet faili hierarhia

            |-modules.pp
|-manifests-|-nodes.pp
|           |-site.pp
|
|-modules---|-apache2--------------|-manifests-|-init.pp
                                   

Puppetmasteri seadistamine

Loome puppeti jaoks vajalikud failid

touch /etc/puppet/manifests/site.pp
touch /etc/puppet/manifests/nodes.pp
touch /etc/puppet/manifests/modules.pp

Loome apache 2 mooduli jaoks vajalikud kaustad ja failid

mkdir -p /etc/puppet/modules/apache2/manifests
touch /etc/puppet/modules/apache2/manifests/init.pp

Loome noded

Selleks muudame faili nodes.pp

nano /etc/puppet/manifests/nodes.pp

Lisame read

nodes basenode {
 include apache2
} 

Mooduli loomine

Muudame apache2 init.pp faili

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

Lisame read

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

Lisame apache2 mooduli puppeti moodulisse

Lisame puppeti modules.pp faili vajalikud read:

nano /etc/puppet/manifests/modules.pp
 import "apache2"

Muudame site.pp faili

Lisame rea:

import "nodes"

Puppetmasteri taaskäivitamine

service puppetmaster restart

Mooduli testimine puppetis

puppet agent --test

Autorid

Tarmo Trumm

Olle Tuur