...
sudo apt-get install puppet puppetmaster
sudo puppet apply# execute 'apt-get update'
Updating Ubuntu
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}# install apache2 package
Installing Apache2
package { 'apache2':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}# ensure apache2 service
Ensuring Apache2 is running
service { 'apache2':
ensure => running,
}
Creating a Group and Assigning a GID
group { 'serveradmin':
ensure => 'present',
gid => '3000',
}
Creating a User
user { 'serveradmin':
ensure => 'present',
managehome => 'true',
home => '/home/serveradmin',
comment => 'Server Admin',
groups => 'serveradmin',
password => 'serveradmin',
password_max_age => '99999',
password_min_age => '0',
shell => '/bin/bash',
uid => '3000',
}
# execute 'apt-get update'
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
...
Installing a Database
# install postgresql package
package { 'postgresql':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure postgresql service is running
service { 'postgresql':
ensure => running,
}
Creating a Database Instance
class { 'postgresql::server': }
...