Skip to content

Instantly share code, notes, and snippets.

View ohadlevy's full-sized avatar

Ohad Levy ohadlevy

  • Red Hat
  • Israel
View GitHub Profile
USAGE
local_user{"ohad": uid => 1234, gid => 1234,
comment => "Ohad Levy", sudo => true,
}
define local_user ($comment, $ensure = 'present',
# Generated from passenger-2.2.2.gem by gem2rpm -*- rpm-spec -*-
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%define gemname passenger
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
%define installroot %{buildroot}%{geminstdir}
%define testdir %{installroot}/test/stub/rails_apps/mycook/public
Summary: Apache module for Ruby on Rails support / Rack Applications
Name: rubygem-%{gemname}
#! /usr/bin/env ruby
class Puppetca
# removes old certificate if it exists and removes autosign entry
# parameter is the fqdn to use
def self.clean fqdn
command = "/usr/bin/sudo -S /usr/sbin/puppetca --clean #{fqdn}< /dev/null"
system "#{command} >> /tmp/puppetca.log 2>&1"
#remove fqdn from autosign if exists
Permission denied - /var/lib/puppet/ssl/private_keys/certname.pem
0 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/key.rb 46 in `read'
1 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/key.rb 46 in `read'
2 /usr/lib/ruby/site_ruby/1.8/puppet/indirector/ssl_file.rb 86 in `find'
3 /usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb 198 in `find'
4 /usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb 51 in `find'
5 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/host.rb 130 in `key'
6 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/host.rb 170 in `certificate'
/etc/puppet/namespaceauth.conf
[puppetrunner]
allow puppet.master
diff --git a/app/helpers/hosts_helper.rb b/app/helpers/hosts_helper.rb
index 5a1c338..e5b5ada 100644
--- a/app/helpers/hosts_helper.rb
+++ b/app/helpers/hosts_helper.rb
@@ -18,7 +18,8 @@ module HostsHelper
image = "#{os}.jpg"
title = os
end
- return image_tag("hosts/#{image}", :size => "18x18", :title => title) + " #{record.shortname}"
+ image_tag("hosts/#{image}", :size => "18x18", :title => title) +
<% a = %w{192.168.2.35 192.168.4.96 192.168.3.184 192.168.2.33 192.168.2.32 192.168.2.26 192.168.3.233 192.168.2.25 192.168.3.140 192.168.3.154 192.168.3.231 192.168.2.2 192.168.1.199 192.168.3.134 192.168.5.242 192.168.3.162 192.168.5.92 192.168.3.142 192.168.5.54 192.168.4.56 192.168.4.116 192.168.5.114 192.168.5.95 192.168.4.167 192.168.4.99 192.168.2.6 192.168.5.232 192.168.5.223 192.168.2.7 192.168.4.233 192.168.5.183 192.168.2.1 192.168.3.47 192.168.3.73 192.168.5.93 192.168.4.95 192.168.1.83 192.168.1.84 192.168.2.9 192.168.3.149 192.168.3.100 192.168.3.29 192.168.4.155 192.168.5.94 192.168.4.175 192.168.4.57 192.168.4.92 192.168.5.98 192.168.5.187 192.168.4.122 192.168.2.11 192.168.3.137 192.168.2.36} %>
XXX <%= a.join(" ") %>
cat /tmp/a.pp
$acl=['192.168.2.35','192.168.4.96','192.168.3.184','192.168.2.33','192.168.2.32','192.168.2.26','192.168.3.233','192.168.2.25','192.168.3.140','192.168.3.154','192.168.3.231','192.168.2.2','192.168.1.199','192.168.3.134','192.168.5.242','192.168.3.162','192.168.5.92','192.168.3.142','192.168.5.54','192.168.4.56','192.168.4.116','192.168.5.114','192.168.5.95','192.168.4.167','192.168.4.99','192.168.2.6','192.168.5.232','192.168.5.223','192.168.2.7','192.168.4.233','192.168.5.183','192.168.2.1','192.168.3.47','192.168.3.73','192.168.5.93','192.168.4.95','192.168.1.83','192.168.1.84','192.168.2.9','192.168.3.149','192.168.3.100','192.168.3.29','192.168.4.155','192.168.5.94','192.168.4.175','192.168.4.57','192.168.4.92','192.168.5.98','192.168.5.187','192.168.4.122','192.168.2.11','192.168.3.137','192.168.2.36']
file{"/tmp/out": content => template("/tmp/a.erb")}
cat /tmp/a.erb
XXX <%= acl.join(" ") -%>
#! /usr/bin/env ruby
#
require 'puppet'
if ARGV[0].nil?
warn "usage: #{$0} provide a puppet report"
exit 1
end
report = YAML::load(File.read(ARGV[0]))
require 'net/http'
# Query external DB to fetch latest ssh known hosts, and store locally for 1 hour.
module Puppet::Parser::Functions
newfunction(:sshkeyfromdb, :type => :rvalue) do |args|
#local cache file on each puppetmaster
ssh_keys_file = "/tmp/sshkeys"
#URL to query
host = "puppet"
url = "/setting/ssh_keys"