This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'r10k/puppetfile' | |
require 'gitlab' | |
GITLAB_TRUE = 1 | |
GITLAB_FALSE = 0 | |
# this is just to mirror what we had on the internetz internally | |
task :mirror do | |
gitlab_token = '<REDACTED>' | |
gitlab_host = 'gitlab.example.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppet/bin/ruby | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
def cputs(string) | |
puts "\033[1m#{string}\033[0m" | |
end | |
check_resource = ARGV[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'puppet' | |
require 'terminal-table' | |
output = Hash.new | |
Factspath = ARGV[0] | |
FACTS = ['osfamily','lsbmajdistrelease','puppetversion','rubyversion','virtual','architecture','role','gpu','location'] | |
#raise "Must pass facts directory as postional parameter 1" unless Dir.exists?(Factspath) or Factspath.nil? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'puppetclassify' | |
require 'puppet' | |
# Have puppet parse its config so we can call its settings | |
Puppet.initialize_settings | |
# Read classifier.yaml for split installation compatibility | |
def load_classifier_config | |
configfile = File.join Puppet.settings[:confdir], 'classifier.yaml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ldap' | |
require 'facter' | |
# This code is only ever loaded in newer versions of puppet and ruby | |
# https://github.com/puppetlabs/puppet-specifications/blob/master/language/func-api.md | |
Puppet::Functions.create_function(:get_ldap_group) do | |
dispatch :get_ldap_group do | |
param 'Variant[Array[String],String]', :groups | |
optional_param 'Variant[Array[String],String]', :attrs | |
optional_param 'Boolean', :single_attr | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'puppet' | |
require 'puppet/util/puppetdb' | |
require 'uri' | |
require 'json' | |
require 'yaml' | |
# Have puppet parse its config so we can call its settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'rugged' | |
require 'octokit' | |
require 'yaml' | |
# needs refactoring for code manager | |
# https://github.com/puppetlabs/control-repo/blob/production/scripts/code_manager_config_version.rb | |
environmentpath = ARGV[0] | |
environment = ARGV[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'puppetclassify' | |
require 'getoptlong' | |
require 'puppet' | |
require 'hiera' | |
require 'facter' | |
require 'r10k/environment' | |
require 'net/ssh' | |
require 'net/scp' | |
require 'resolv' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'puppet' | |
require 'puppet/face' | |
require 'yaml' | |
all_users = Puppet::Face[:resource, '0.0.1'].search("user") | |
puts all_users.to_yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'net/http' | |
require 'json' | |
require 'yaml' | |
# Currently do not have this working with client side SSL, perhaps someone can help with that in the comments. | |
host = 'localhost' | |
port = '8080' | |
http = Net::HTTP.new(host, port) | |
resources_uri = '/pdb/query/v4/resources/User' | |
puts JSON.parse(http.get(resources_uri).body).to_yaml |