Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This is a work in progress...

Connecting a Puppet Master and Agent

...

sudo apt-get install puppetmaster

How to Execute Puppet Scripts

sudo puppet apply "puppet script"

Updating Ubuntu

exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}

Installing Apache2

package { 'apache2':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}

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',
}

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': }

postgresql::server::db { 'testdb':
user => 'admin',
password => postgresql_password('admin', 'c00kies'),
owner => 'admin',
}

class mymodule::myclass{
file { 'my_bash_script':
ensure => 'file',
path => '/home/setupadmin/runthisfile.sh',
owner => 'setupadmin',
group => 'setupadmin',
mode => '0755', # Use 0700 if it is sensitive
notify => Exec['run_my_script'],
}
exec { 'run_my_script':
#path => ["/usr/bin", "/usr/sbin", "/bin/bash"],
command => '/home/setupadmin/runthisfile.sh',
refreshonly => true
}
}
include mymodule::myclass

  • No labels