Skip to content

Instantly share code, notes, and snippets.

View optiz0r's full-sized avatar

Ben Roberts optiz0r

View GitHub Profile
@optiz0r
optiz0r / Catalog
Created December 18, 2013 08:38
Puppet example showing default parameters on exported defined types aren't stored in the catalog
{
u'parameters': {
u'ensure': u'present',
u'path': u'/data/test',
# Missing are job_name, server_name, backup_schedule
},
u'title': u'test',
u'tags': [u'node', u'backup', u'testnode.localdomain', u'class', u'backup::job', u'job'],
u'exported': True,
u'file': u'/home/puppet/production/modules/backup/manifests/init.pp',
@optiz0r
optiz0r / 01-bacula-sd.conf
Last active August 29, 2015 14:27
Bacula virtual autochanger
Storage {
Name = <%= @hostname %>-sd
SDPort = 9103
WorkingDirectory = <%= scope.lookupvar('bacula::real_working_dir') %>
Pid Directory = "/var/run"
}
Director {
Name = <%= scope.lookupvar('bacula::director_name') %>
Password = "<%= scope.lookupvar('bacula::sd_password') %>"
require 'spec_helper'
require 'puppet/type/entropy_mask'
require 'puppet/type/entropy_unmask'
require 'puppet/type/entropy_splitdebug'
require 'puppet/type/entropy_splitdebug_mask'
types = {
:entropy_mask => Puppet::Type::Entropy_mask,
:entropy_unmask => Puppet::Type::Entropy_unmask,
:entropy_splitdebug => Puppet::Type::Entropy_splitdebug,
@optiz0r
optiz0r / 01-type
Last active October 13, 2016 14:37
Puppet::Type.newtype(:entropy_mask) do
@desc = "Mask packages in Entropy"
ensurable
newparam(:name) do
desc "Unique name for this mask"
end
newproperty(:operator) do
# == Class: site::letsencrypt
#
class site::letsencrypt (
$tsig_name,
) {
if hiera('letsencrypt::letsencrypt_host') == $::fqdn {
class {
'::letsencrypt':
hook_content => template('site/etc/dehydrated/dehydrated_nsupdate.sh.erb'),
letsencrypt_contact_email => '[email protected]',
@optiz0r
optiz0r / 01-bacula-zfs-send.sh
Created May 1, 2017 20:21
Simple bacula ZFS/bpipe fileset and wrapper scripts
#!/bin/sh
#
# A script which does everything bacula bpipe needs ie:
# - create a snapshot with the current date / time
# - do a zfs send out of that snapshot
# - clean up snapshot when complete
#
FILESYSTEM=$1
@optiz0r
optiz0r / puppet_env.ddl
Last active September 18, 2019 21:43
puppet_env
metadata :name => "puppet_env",
:description => "Triggers updates of puppetserver environments using puppet-env-manager library",
:author => "Ben Roberts",
:license => "Apache-2.0",
:version => "0.1",
:url => "https://github.com/optiz0r/puppet-env-manager-agent",
:provider => "external",
:timeout => 900
@optiz0r
optiz0r / nomad.pp
Created April 20, 2020 16:52
puppet code for deploying nomad as a docker container
# == Class: sihnon::nomad
#
# Deploys nomad in docker
#
class sihnon::nomad (
String $image_name = 'optiz0r/nomad',
String $image_tag = '0.11.0-beta2',
String $root_dir = '/srv/nomad',
String $cert_name = $::fqdn,
Array[Stdlib::Host] $servers = [
@optiz0r
optiz0r / README.md
Created December 14, 2020 08:35
Choria Playbook to upgrade a nomad cluster

Upgrade Nomad cluster

This Choria Playbook will automate the steps to do a simple version upgrade on a nomad cluster.

  • Upgrades servers first
  • Then upgrades clients
  • Sleeps in between each upgrade to allow things to settle
  • Aborts on any error

Dependencies

_choria_bash_autocomplete() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if ( _array_contains COMP_WORDS "req" || _array_contains COMP_WORDS "rpc" ) && [[ ${COMP_WORDS[$COMP_CWORD]} != "-"* ]] ; then
_choria_req_bash_autocomplete
else
opts=$( ${COMP_WORDS[0]} --completion-bash ${COMP_WORDS[@]:1:$COMP_CWORD} )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )