This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define homebrew::tap ( | |
$ensure = present, | |
) { | |
if $ensure == 'present' { | |
exec { "homebrew_tap_${name}": | |
command => "brew tap ${name}", | |
unless => "brew tap | grep ${name}", | |
} | |
} else { | |
exec { "homebrew_untap_${name}": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define dot::file { | |
file { "${my_homedir}/.${name}": | |
ensure => link, | |
mode => '0644', | |
target => "${my_sourcedir}/dotfiles/${name}", | |
require => Repository["${my_sourcedir}/dotfiles"], | |
} | |
} | |
dot::file { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = ['1', '2', '3', '4'] | |
define loop ( | |
$data | |
) { | |
$var = parsejson(inline_template("<%= (data.collect{|x| name+'/'+x}).to_pson %>")) | |
hack { $var: | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Puppet::Parser::Functions::newfunction(:module_file, :type => :rvalue, :doc => " | |
Function module_file: | |
load file from relative or absolute path, relative path will search puppet modules files directory. | |
") do |args| | |
raise Puppet::ParseError, "module_file(): wrong number of arguments #{args.length}, expecting (filename)." if args.length != 1 | |
raise Puppet::ParseError, "module_file(): does not accept empty file path." unless args[0] | |
file = args[0] | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f5_key { 'puppet.key': | |
ensure => 'present', | |
content => file("${settings::ssldir}/ca/ca_key.pem"), | |
mode => 'MANAGEMENT_MODE_DEFAULT', | |
} | |
f5_profileclientssl { 'puppetmaster': | |
ensure => present, | |
certificate_file => 'puppet.crt', | |
key_file => 'puppet.key', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is intended to be used with the install action | |
# of puppet-cloudpack | |
set -u | |
set -e | |
function fedora_repo() { | |
cat >/etc/yum.repos.d/puppet.repo <<'EOFYUMREPO' | |
[puppetlabs] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-key adv --recv-key --keyserver pool.sks-keyservers.net 4BD6EC30 | |
apt-get update | |
apt-get -y install lsb-release | |
distro=$(lsb_release -i | cut -f 2 | tr "[:upper:]" "[:lower:]") | |
release=$(lsb_release -c | cut -f 2) | |
cat > /etc/apt/sources.list.d/puppetlabs.list <<EOFAPTREPO | |
deb http://apt.puppetlabs.com/${distro}/ ${release} main | |
EOFAPTREPO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define mytype { | |
# resource type that I don't want file to purge: | |
# vhost { $name: ... } | |
file { "/tmp/www/${name}": | |
} | |
} | |
file { '/tmp/www': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class a { | |
$var = '' | |
} | |
class c { | |
include a | |
notice ($a::var) | |
} | |
class b { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'parser-emit' | |
class Puppet::Parser::AST::Definition | |
attr_accessor :name | |
end | |
class Manifest | |
class << self | |
#include Enumerable |