Skip to content

Instantly share code, notes, and snippets.

@antaflos
antaflos / db01.example.com.yaml
Created March 20, 2014 20:45
is it possible to call a Puppet function like postgresql_password() when looking up data from Hiera (and using create_resources())?
---
profile::postgresql::server::dbs:
redmine:
user: redmine
password: "postgresql_password('redmine', 'xxx')"
# The above results in puppetlabs-postgresql's Postgresql::Server::Role class
# passing the string "postgresql_password('redmine', 'xxx')" verbatim as
# ENCRYPTED PASSWORD to the ALTER ROLE statement postgresql_psql creates, which of course fails.
@antaflos
antaflos / logstash.conf
Created March 6, 2014 10:12
Logstash parse failure with TCP input and JSON codec. LS 1.3.3.
input {
log4j {
port => 4560
type => "log4j"
codec => plain { charset => "ISO-8859-1" }
}
tcp {
codec => oldlogstashjson
port => 4561
input {
log4j {
port => 4560
type => "log4j"
codec => plain { charset => "ISO-8859-1" }
}
tcp {
codec => oldlogstashjson
port => 4561
@antaflos
antaflos / gist:7648406
Last active December 29, 2015 09:09
Order seems to matter when mixing include-style and resource-style class declarations. Or is this a problem specific to the puppetlabs-apache module?
node 'web02.example.com' {
  include 'some::other::modules'
  include 'even::more::modules'

  # Declare apache::mod::php before apache
  include 'apache::mod::php'
  class { 'apache':
    mpm_module => 'prefork',
  }
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@antaflos
antaflos / gist:7085586
Last active December 26, 2015 03:19
hiera hashes with no key-value pairs for feeding into create_resources
# How does one define a hash with a name but no keys/values?
---
site_repos_ppa:
'ppa:git-core/ppa':
'ppa:mercurial-ppa/releases':
@antaflos
antaflos / gist:6709690
Last active December 23, 2015 23:19
Shouldn't a deep merge by Hiera (1.2.1, :merge_behaviour: deeper) produce a users hash for user "ant" with four groups?
# common.yaml:
users:
ant:
uid: 1001
realname: Andreas
pwhash: '$6$thesalt$thehash'
groups:
- sudo
- adm
@antaflos
antaflos / sasl.erb
Created July 23, 2012 17:44
augeas erb iteration
rm sasl_allowed_username_list
<% i = 0 %>
<% sasl_allowed_usernames.each do |username| -%>
<% i += 1 %>
set sasl_allowed_username_list/<% sprintf("%02d", i) -%> <%= username %>
<% end -%>
@antaflos
antaflos / foreman-ubuntu-10.04-12.04.ptable
Created June 14, 2012 23:15
Foreman Ubuntu 10.04/12.04 partition table
d-i partman-auto/disk string /dev/vda
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string vg_sys01
d-i partman-auto-lvm/no_boot boolean true
d-i partman-auto/method string lvm
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
@antaflos
antaflos / foreman-ubuntu-12.04.pxe
Created June 14, 2012 16:34
Foreman Ubuntu 12.04 PXE provision template
default Ubuntu
label Ubuntu
kernel <%= @kernel %>
append initrd=<%= @initrd %> video=vga16fb:off vga16fb.modeset=0 interface=eth0 url=<%= foreman_url("provision")%> ramdisk_size=10800 root=/dev/rd/0 rw auto=true priority=critical hostname=unassigned-hostname DEBCONF_DEBUG=5 language=en locale=en_IE.UTF-8 console-setup/ask_detect=false keyboard-configuration/layoutcode=de console-keymaps-at/keymap=de-latin1-nodeadkeys keyboard-configuration/xkb-keymap=de debian-installer/country=AT debian-installer/fb=false BOOTIF=<%= mac %>