Skip to content

Instantly share code, notes, and snippets.

@fiddyspence
fiddyspence / gist:4080246
Created November 15, 2012 18:17
Hiera fu
[root@puppet1 manifests]# hiera masterconfig
{"keepalive"=>6, "backup"=>["puppet-lvsfe2.spence.org.uk.local", "192.168.0.128"], "vip"=>"192.168.0.40", "servers"=>[["puppetha1.spence.org.local", "192.168.0.122"], ["puppetha2.spence.org.uk.local", "192.168.0.124"]], "port"=>539, "primary"=>["puppet-lvsfe1.spence.org.uk.local", "192.168.0.126"]}
[root@puppet1 type]# puppet apply -e "sshkey { 'myhost': ensure => present, host_aliases => ['ddb7.domain.tld', 'db7', ['1.2.3.4', '2001:0db8:85a3::8a2e:0370:7334']], key => 'AAAAB3NzaC1yc2EAAAABIwAAAQEAutSQCltTybWVT6DpYOcSxJkJwl+aM9SscXlhEc3aKTqO+/bIvghCKB04iP98yfjD0S1+K/XSEuIciznhDaE+WFpOQoFyNoSeRQlkweDUX5TjbvQDQHIaecpEB9BxedSDnLKvqdLYDXmj9Jwt/UJ2d49SNblD87QOmZ/5r2wDv8wNRWBMjVdAV6mj8bHWtZEwaZ/7foqIMYOEA0EBQ5pwSyUq9XxHhlJd980HHKA8LuZTo/zdQhlo9ut006sZtFkjtkvhretHwedMdh8NIFi7VOQVvHE0JTniIianKruPyglMjbvVf7m/lISmmC8j4ovbSocZ/CJ0/9D/r1qQP6uekw==', type => 'rsa',}"
notice: /Stage[main]//Sshkey[myhost]/host_aliases: host_aliases changed ['ddb7.domain.tld', 'db7', '1.2.3.4', '2001:0db8:85a3::8a2e:0370:7334'] to 'ddb7.domain.tld db7 1.2.3.4 2001:0db8:85a3::8a2e:0370:7334'
notice: Finished catalog run in 0.46 seconds
[root@puppet1 type]# puppet apply -e "sshkey { 'myhost': ensure => present, host_aliases => ['ddb7.domain.tld', 'db7', ['1.2.3.4', '2001:0db8:85a3::8a2e:0370:7334']], key => 'AAAAB3NzaC1yc2EAAAABIwAAAQEAu
[root@puppet1 facter]# mkdir /tmp
mkdir: cannot create directory `/tmp': File exists
[root@puppet1 facter]# mkdir /tmp/moo
[root@puppet1 facter]# chmod 644 /tmp/moo
[root@puppet1 facter]# su - fids
[fids@puppet1 ~]$ cd /tmp/moo
-bash: cd: /tmp/moo: Permission denied
[fids@puppet1 ~]$
@fiddyspence
fiddyspence / gist:4419914
Last active December 10, 2015 10:18
link
[root@centos62 ~]# cat tomcat.pp
$apache_tomcat_log = "/var/log/tomcat"
$apache_tomcat_log_mount = "/usr/local/tomcat/logs"
class apache_tomcat::log {
file { $apache_tomcat_log_mount:
ensure => 'link',
force => true,
target => $apache_tomcat_log,
# require => Class["apache_tomcat::config"]
@fiddyspence
fiddyspence / gist:4672654
Created January 30, 2013 11:30
/etc/puppetlabs/puppet/hiera.yaml
---
:backends: - yaml
:logger: console
:hierarchy: - %{fqdn}
- %{environment}
- common
:yaml:
:datadir: /etc/puppetlabs/hieradata
@fiddyspence
fiddyspence / gist:4714456
Created February 5, 2013 13:28
noo - hang on, what?
[root@demomaster ~]# cat noop.pp
notify { 'test':
noop => false,
}
file { '/tmp/tard':
content => 'poo',
noop => false,
}
[root@demomaster ~]# puppet apply noop.pp --noop
@fiddyspence
fiddyspence / amazonrpm
Last active December 14, 2015 16:39
Hold on!
=====================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================
Removing:
rsyslog i686 5.8.10-2.17.amzn1 installed 2.0 M
Removing for dependencies:
cloud-init noarch 0.5.15-66.amzn1 installed 218 k
cronie i686
@fiddyspence
fiddyspence / gist:5237023
Last active December 15, 2015 09:19
mysql foo
database { 'foo':
ensure => $ensure,
charset => $charset,
provider => 'mysql',
require => Class['mysql::server'],
}
database { 'bar':
ensure => $ensure,
charset => $charset,
@fiddyspence
fiddyspence / gist:5460340
Created April 25, 2013 14:56
augeasfacter you bastard!
[root@chris modules]# puppet apply -e 'notify{"moo":}'
notice: Finished catalog run in 0.05 seconds
[root@chris modules]# mv augeasfacter /tmp
[root@chris modules]# puppet apply -e 'notify{"moo":}'
notice: moo
notice: /Stage[main]//Notify[moo]/message: defined 'message' as 'moo'
notice: Finished catalog run in 0.05 seconds
@fiddyspence
fiddyspence / gist:5644024
Created May 24, 2013 14:43
Will you just look at that!
module Puppet::Parser::Functions
newfunction(:base64, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
ENDHEREDOC
require 'base64'
raise Puppet::ParseError, ("base64(): Wrong number of arguments (#{args.length}; must be = 2)") unless args.length == 2
actions = ['encode','decode']