This file contains 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 'digest/md5' | |
require 'fileutils' | |
require 'net/http' | |
require 'uri' | |
require 'timeout' | |
require 'json' | |
# Retrieves info from DCM | |
Puppet::Functions.create_function(:'dcm::cached_request') do | |
# Retrieves info from http endpoint and caches response |
This file contains 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
module Role | |
def self.add_facts | |
add_role | |
add_subrole | |
add_num | |
fqdn = Facter.value(:fqdn) | |
if fqdn =~ /^\w+\.dev\.mycorp\.com/ | |
add_fact(:subproject, 'none') | |
add_fact(:project, 'rsglab') |
This file contains 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 'spec_helper' | |
require 'json' | |
describe 'dcm::get' do | |
let(:uri) { 'https://baz.bar.org/api/v2/x/y?host=foo.bar.org' } | |
let(:response_string) { '{"count":1,"next":null,"previous":null,"results":[{"id":2061,"dataset":"foo","port":3314}]}' } | |
let(:response) { JSON.parse(response_string) } | |
let(:result) { 'foo' } |
This file contains 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
--- | |
version: 5 | |
defaults: | |
datadir: hiera | |
lookup_key: eyaml_lookup_key | |
options: | |
pkcs7_private_key: '/etc/puppetlabs/puppet/eyaml/private_key.pkcs7.pem' | |
pkcs7_public_key: '/etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pem' | |
hierarchy: |
This file contains 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
--- | |
version: 5 | |
defaults: | |
datadir: data | |
data_hash: yaml_data | |
default_hierarchy: | |
- name: 'OS-specific Module Data' | |
path: "%{facts.os.family}.yaml" | |
- name: 'Common Module Data' | |
path: 'common.yaml' |
This file contains 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
$t = @(EOF) | |
<%= | |
# remove dynamic facts and class params | |
$facts.reduce( {} ) | $memo, $entry | { | |
if $entry[0] !~ /^(server.*|facts|system_uptime|uptime.*|rubysitedir|_timestamp|memoryfree.*|swapfree.*|.*temperature.*|hpraid.*|hparray.*power_on_hours|hparray.*estimated_life_remaining_based_on_workload_to_date|title|name|caller_module_name|module_name|lib|path|packages|version|mysql_instances|ilo_facterfile_age|ilo_ipv6_.*|sshfp_.*|environment|clientnoop)$/ { | |
$memo + { $entry[0] => $entry[1] } | |
} | |
} | |
%> | |
EOF |
This file contains 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 'json' | |
Puppet::Type::type(:pulp_repo).provide(:rpm) do | |
commands :pulp_admin => 'pulp-admin' | |
commands :mongoexport => 'mongoexport' | |
# magically define all getter methods (Thanks, Luke!) | |
mk_resource_methods | |
# query the pulp_database and merge some fields from multiple tables |
This file contains 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 'puppet/type' | |
require 'uri' | |
require 'puppet/parameter/boolean' | |
Puppet::Type.newtype(:pulp_repo) do | |
desc "Type to manage Pulp repos" | |
ensurable | |
newparam(:id, :namevar => true) do | |
desc "Id of the repo" |
This file contains 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
#!/bin/bash | |
export PATH="/sbin:/bin:/usr/sbin:/usr/bin" | |
readonly APTOPTS='-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' | |
function install_puppet() { | |
pushd /root > /dev/null | |
wget http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb | |
dpkg -i puppetlabs-release-wheezy.deb | |
apt-get update |
NewerOlder