Skip to content

Instantly share code, notes, and snippets.

View alvagante's full-sized avatar

Alessandro Franceschi alvagante

View GitHub Profile
# Rubocop on a bran new pdk Gemfile:
al@lab tmp $ pdk new module sample --skip-interview
pdk (INFO): Creating new module: sample
al@lab tmp $ rubocop sample/Gemfile
Inspecting 1 file
C
Offenses:
#
#
# = Define: tp::netinstall
#
# This define installs application from their upstream source code
#
#
# == Parameters
#
define tp::netinstall (
@alvagante
alvagante / gist:b8f67647c78590f3e67a
Created October 24, 2014 14:53
Hiera examples for example42/puppet-network
# Single interface with hostname
---
network::hostname: 'host.my.domain'
network::interfaces_hash:
eth0:
ipaddress: 172.17.1.10
broadcast: 172.17.1.255
netmask: 255.255.245.0
gateway: 172.17.1.1
@alvagante
alvagante / ModulesUsage.rdoc
Created April 10, 2012 14:13
Example42 NextGen modules general usage documentation

MODULES USAGE

The NextGen Example42 Puppet modules share a common layout that makes it possible to use them with a coherent and standard (at least inside the same module set) appoach.

All the new modules have a set of standard arguments to manage common tasks and, of course, some module specific ones.

Here are the common options and usage patterns that you can find generally on all the NextGen modules.

ALTERNATIVE OPTIONS TO PROVIDE DATA

In the NextGen Example42 modules you have 3 different ways to provide variables to a module:

@alvagante
alvagante / ModulesExamples.rdoc
Created April 10, 2012 14:08
Usage samples of the NextGen Example42 Puppet modules

MODULES USAGE EXAMPLES

Here are some usage examples of the NextGen example42 Puppet modules.

SETTING MONITORING / FIREWALLING BEHAVIOUR

Here’s an example on how you can mix general top scope variables and a module without customizing its configuration.

General Top Scope variables in site.pp (or via an ENC or on Hiera):

$puppi = true
@alvagante
alvagante / add_arguments.rb
Created October 28, 2011 08:20
Puppet add_arguments.rb
Puppet::Parser::Functions::newfunction(:add_arguments, :doc => <<-'ENDHEREDOC') do |args|
Converts a hash into a set of arguments that are added to the specified resource.
This function takes two arguments: a resource name, and a hash describing
a set of resources. The hash should be in the form `{title => {parameters} }`:
# A hash of arguments:
$myarguments = {
uid => '1330',
group => allstaff,