Skip to content

Instantly share code, notes, and snippets.

@saz
saz / users.rb
Created November 21, 2024 16:25
Facter fact to get all users and their SSH pub keys
# frozen_string_literal: true
require 'etc'
require 'English'
Facter.add(:users) do
setcode do
users = {}
Etc.passwd do |u|
sshdir = File.join(u.dir, '.ssh')
@saz
saz / init.pp
Last active June 20, 2018 05:44
hiera and variables inside a string - possible?
class timezone (
String $timezone = 'Etc/UTC',
Optional[String] $timezone_update = undef
) {
# data from hiera with a variable inside?
if $timezone_update {
exec { 'update_timezone':
command => $timezone_update,
}
}
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1e:67:a4:ba:b6 brd ff:ff:ff:ff:ff:ff
inet x.x.116.204/27 brd 5.9.116.223 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.0.2/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 xxx:61c5::2/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::21e:67ff:fea4:bab6/64 scope link
valid_lft forever preferred_lft forever
@saz
saz / gist:5332796
Created April 7, 2013 22:16
Puppet Filebucket config
# The filebucket option allows for file backups to the server
filebucket { 'main':
server => 'puppetmaster.example.com',
path => false,
}
# Set global defaults
File { backup => main }
@saz
saz / mongrel_send_cookie.patch
Created June 10, 2011 05:41
Mongrel: #<NoMethodError: undefined method `[]' for nil:NilClass> with rails 2.3.5 on Debian Lenny