ChrisPeterson.info

August 4, 2017

My Puppet skeleton profile



This might come in handy for someone using Puppet with the “roles and profiles” design pattern. Having this profile sitting idly by to provide the boilerplate for a new profile has helped me be lazy in a good way.

# lint:ignore:autoloader_layout
class profile::skeleton {
  class { 'profile::skeleton::install': }
  -> class { 'profile::skeleton::config': }
  -> class { 'profile::skeleton::service': }
  -> class { 'profile::skeleton::logging': }
  -> class { 'profile::skeleton::firewall': }
  -> class { 'profile::skeleton::monitoring': }
  -> class { 'profile::skeleton::backups': }
}

# Install!
class profile::skeleton::install {
  $packages = [
    # 'packagename',
  ]
  package { $packages:
    ensure => 'installed',
  }
}

# Config!
class profile::skeleton::config {
  include stdlib

  # class { 'service:
  #   params => 'values',
  # }
  # or manage files here
}

# Service!
class profile::skeleton::service {
  $services = [
    # 'servicename',
  ]
  service { $services:
    ensure => 'running',
    enable => true,
  }
}

# Logging!
class profile::skeleton::logging {
  # logrotate::rule { default: *=> $profile::logging::logrotate_defaults;
  #   'thisprofile_servicename':
  #     path => '/path/to/logfiles/*.log /path/to/other/files/*.err',
  #   ;
  # }
}

# Monitoring
class profile::skeleton::monitoring {
  include profile::nagios::client

  # $services = {
  #   "${::fqdn}_check_thing" => {
  #     'service_description'         => 'TCP port bla bla',
  #     'check_command'               => 'check_tcp!666!5!10',
  #     'use'                         => 'level3',
  #     'servicegroups'               => 'skeleton',
  #   },
  # }
  # create_resources('@@nagios_service', $services, $profile::nagios::client::service_defaults)
}

# Firewall
class profile::skeleton::firewall {
    $ports = [
      # 666, # description
    ]
    # $ports.each |$thisport| {
    #   firewall { "0401_skeleton_${thisport}":
    #     proto  => 'tcp',
    #     action => 'accept',
    #     dport  => $thisport,
    #   }
    # }
}

# Backup management
class profile::skeleton::backups {}

# lint:endignore