Skip to content

Instantly share code, notes, and snippets.

View dgrstl's full-sized avatar

David Roberts dgrstl

View GitHub Profile
@dgrstl
dgrstl / refresh_classes.sh
Created January 13, 2015 16:04
NC Refresh
!/bin/bash
# simple 3.7 NC classifier commands
declare -x PE_CERT=$(/opt/puppet/bin/puppet agent --configprint hostcert)
declare -x PE_KEY=$(/opt/puppet/bin/puppet agent --configprint hostprivkey)
declare -x PE_CA=$(/opt/puppet/bin/puppet agent --configprint localcacert)
declare -x NC_CURL_OPT="-s --cacert $PE_CA --cert $PE_CERT --key $PE_KEY --insecure"
@dgrstl
dgrstl / gist:ad7a1449cd33cc932033
Created June 9, 2015 18:35
Choco installdir problem
2. When I install notepadplusplus and If I force it to get installed on e:\notepadplusplus. Chocolatey logs shows its installed and it gets installed in c:\program files\notepad++. I don’t see any errors in the chocolatey logs.
Puppet code:
class learn03{
if $::kernel == windows{
Package { provider =>chocolatey}
conf t
hostname n9kv
ip domain-lookup
ip domain-name localdomain
vrf context management
ip domain-name localdomain
ip name-server 10.240.0.10
interface mgmt0
vrf member management
ip address dhcp
require 'json'
require 'csv'
f = File.open('foo.json')
csv_out = CSV.generate do |csv|
nodes = JSON.parse(f.read)
#create header
entry = nodes.first
csv << ['node'] + entry[1].keys
require 'json'
require 'csv'
require 'puppet/face'
# Requires installation of https://forge.puppetlabs.com/dalen/puppetdbquery
# comma separated list of fact names you care about
whitelist = File.open('whitelist.csv').read.chomp
headers = whitelist.split(',')
# get yo data
class dellpoc::dell_sccm {
exec { 'intsall_sccm':
provider => 'windows',
command => '\\\\AUSPWCFGAM1.aus.amer.dell.com\\client\\am1install.bat',
unless => 'c:\windows\system32\sc.exe query ccmexec',
} ->
file {'c:\windows\cmtrace.exe':
ensure => 'file',
class dellpoc::dell_sccm {
exec { 'intsall_sccm':
provider => 'windows',
command => '\\\\AUSPWCFGAM1.aus.amer.dell.com\\client\\am1install.bat',
unless => 'c:\windows\system32\sc.exe query ccmexec',
}
file {'c:\windows\cmtrace.exe':
ensure => 'file',
#!/bin/bash
#Only edit these two lines:
#username for the console:
PUPPET_PE_CONSOLEPWD='puppetlabs'
PUPPET_PE_VERSION='2015.3.2'
# STOP DO NOT EDIT BELOW THIS LINE
MD="http://169.254.169.254/latest/meta-data/"
PUBLIC_HOSTNAME=$(curl -fs $MD/public-hostname)
@dgrstl
dgrstl / foo
Created February 18, 2016 21:20
ash-3.2# puppet apply -d create_master.pp
Debug: Runtime environment: puppet_version=4.2.0, ruby_version=2.1.6, run_mode=user, default_encoding=US-ASCII
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (cache ttl: 0)
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (cache ttl: 0)
Not an EC2 host
value for agent_specified_environment is still nil
value for cfkey is still nil
Found no suitable resolves of 1 for filesystems
{
"details": {
"message": "throw+: {:kind :puppetlabs.code-manager/shell-failed, :result {:exit-code 1, :stderr \"\u001b[31m\\nError while running: #<R10K::Error: Unable to determine current branches for Git source 'puppet' (/etc/puppetlabs/code-staging/environments)>\u001b[0m\\n\", :stdout \"\"}}",
"trace": [
"puppetlabs.code_manager.core$collect_environments.invoke (core.clj:46)",
"puppetlabs.code_manager.shell_workers$build_collect_all_fn$collect_all__19045.invoke (shell_workers.clj:70)",
"puppetlabs.code_manager.app$build_deploy_handler$deploy_handler__18554.invoke (app.clj:76)",
"puppetlabs.code_manager.app$wrap_format_errors$format_errors__18564.invoke (app.clj:119)",
"ring.middleware.json$wrap_json_response$fn__14057.invoke (json.clj:65)",
"ring.middleware.json$wrap_json_body$fn__14040.invoke (json.clj:33)",