Van Puppetlabs Learning Puppet vm

A module is a bundle of Puppet code packaged along with the other files and data you need manage some aspect of a system.
Need to set up NTP? There's a module for that.
Manage system users? That too.
But likely you'll want to do both of these things and more.
Modules let you mix and match reusable bits of Puppet code to make achieving your desired configuration as painless as possible.
Modules are designed to be, well, modular.


Puppet Forge is a public repository of modules contributed by members of the Puppet community, including many written and maintained by Puppet Labs employees and partners.

A class is simply a named block of Puppet code organized in a way that defines a set of associated system resources.
A class might install a package, customize an associated configuration file for that package, and start a service provided by that package.
These are related and interdependent processes, so it makes sense to organize them into a single configurable unit: a class.
Classification tells Puppet which classes to apply to which machines in your infrastructure.

Node groups allow you to segment all the nodes in your infrastructure into separately configurable groups based on information collected by the facter tool.

The block of code that describes a resource is called a resource declaration.
These resource declarations are written in Puppet code, a Domain Specific Language (DSL) built on Ruby.
If you are curious to learn about all of the different built-in resources types available for you to manage,
see the Type Reference Document http://docs.puppetlabs.com/references/latest/type.html
Core resource types you'll likely encounter most often:

The modulepath All modules accessible by your Puppet Master are located in the directories specified by the modulepath variable in Puppet's configuration file.
On the Learning VM, this configuration file is /etc/puppetlabs/puppet/puppet.conf
You will work in the /etc/puppetlabs/puppet/environments/production/modules directory.
This is where you keep modules for your production environment. (Site specific modules you need to be available for all environments are kept in /etc/puppetlabs/puppet/modules , and modules required by Puppet Enterprise itself are kept in the /opt/puppet/share/puppet/modules directory. A module consists of a pre-defined structure of directories that help Puppet reliably locate the module's contents.

=======================================================================

Tools

=======================================================================

command for installing apache if there is internet connection

command for installing apache without internet connection

command to display ipaddress

command to trigger puppet run

======================= Command's

class lvmguide (
$document_root = '/var/www/html/lvmguide',
$port          = '80',
) {
# Manage apache, the files for the website will be
# managed by the quest tool
class { 'apache':
default_vhost => false,
}
apache::vhost { 'learning.puppetlabs.vm':
port    => $port,
docroot => $document_root,
}
}

quest update

quest --start resources puppet resource user root

user { 'root':

ensure           => 'present',
comment          => 'root',
gid              => '0',
home             => '/root',
password         => '$1$jrm5tnjw$h8JJ9mCZLmJvIxvDLjw1M/',
password_max_age => '99999',
password_min_age => '0',
shell            => '/bin/bash',
uid              => '0',

}

puppet describe user puppet apply -e "user { 'galatea': ensure => 'present', }" puppet resource user galatea puppet resource -e user galatea comment => 'Galatea of Cyprus', quest --start manifests_classes cd /etc/puppetlabs/puppet/environments/production/modules vim cowsayings/manifests/cowsay.pp class cowsayings::cowsay { package { 'cowsay': ensure => 'present', } } puppet apply --noop cowsayings/tests/cowsay.pp puppet parser validate cowsayings/manifests/cowsay.pp vim cowsayings/tests/cowsay.pp include cowsayings::cowsay puppet apply --noop cowsayings/tests/cowsay.pp puppet apply cowsayings/tests/cowsay.pp cowsay Puppet is awesome! vim cowsayings/manifests/fortune.pp class cowsayings::fortune { package { 'fortune-mod': ensure => 'present', } } puppet parser validate cowsayings/manifests/fortune.pp vim cowsayings/tests/fortune.pp include cowsayings::fortune puppet apply --noop cowsayings/tests/fortune.pp puppet apply cowsayings/tests/fortune.pp vim cowsayings/manifests/init.pp class cowsayings { include cowsayings::cowsay include cowsayings::fortune } puppet parser validate cowsayings/manifests/init.pp vim cowsayings/tests/init.pp include cowsayings puppet apply -e "package { 'fortune-mod': ensure => 'absent', } \ package {'cowsay': ensure => 'absent', }" puppet apply --noop cowsayings/tests/init.pp puppet apply cowsayings/tests/init.pp puppet agent --configprint modulepath ls /etc/puppetlabs/puppet/environments/production/modules tree -L 2 -d /etc/puppetlabs/puppet/environments/production/modules/ cd /etc/puppetlabs/puppet/environments/production/modules mkdir vimrc mkdir vimrc/{manifests,tests,files} cp ~/.vimrc vimrc/files/vimrc set number Create the init.pp manifest in your module's manifests directory. vim vimrc/manifests/init.pp class vimrc { file { '/root/.vimrc': ensure => 'present', source => 'puppet:///modules/vimrc/vimrc', } } puppet parser validate vimrc/manifests/init.pp To test the vimrc class, create a manifest called init.pp in the vimrc/tests directory. vim vimrc/tests/init.pp All you'll do here is declare the vimrc class with the include directive. include vimrc Apply the new manifest with the --noop flag. If everything looks good, drop the -- noop and apply it for real. puppet apply --noop vimrc/tests/init.pp puppet apply vimrc/tests/init.pp NTP First, check the state of the NTP package: puppet resource package ntp check the NTP configuration file: puppet resource file /etc/ntp.conf finally, see if the Network Time Protocol Daemon (NTPD) service is running: puppet resource service ntpd Use the puppet module tool to install the Puppet Labs ntp module. puppet module install puppetlabs-ntp hier waren we en vergeten hierboven bij te werken Database, User, Grant:  Task 5 : These custom resource types make creating a new d