Skip to content

Instantly share code, notes, and snippets.

$install_dir = '/opt/cloud-private-ce'
$public_ip = $facts[ipaddress]
$shared_root_password = 'puppetlabs'
$shared_root_pw_hash = '$6$bdVLCr58$TtGGFM8FH9jhSL6ZB9gXHncCm30gMKcHER.ByqL6zAMjarUVtSZ.SqKfhw7ip5NKR0iRVC8/Gx5KrMfrb1GSP0'
$config_yaml = @("END")
---
ansible_user: root
ansible_ssh_pass: $shared_root_password
ansible_ssh_common_args: "-oPubkeyAuthentication=no"
#!/bin/bash
GET_FACTS_FROM_CERTNAME="win-2016-49.inf.puppet.vm"
CERTNAME_FOR_OUTPUT="mission-3"
FAKE_NODES="fake-nodes.localdomain"
#make sure jq and rhino javascript installed
jq_path=$(which jq 2> /tmp/get-win-facts.log)
if [ -x "$jq_path" ] ; then
echo "jq is installed: $jq_path" >> /tmp/get-win-facts.log
facts = [
{
"name": "processors",
"value": "{\"isa\":\"x64\",\"count\":4,\"models\":[\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\"],\"physicalcount\":4}",
"environment": "production",
"id": "mission-3-processors"
}
]
function prettyStructured (k,v) {
try {if (k == "value" && typeof(JSON.parse(v)) == "object") {
v = JSON.stringify(JSON.parse(v), null, 2).replace(/\n/g, "\n");
} } catch(e) {}
return v;
}
JSON.stringify(facts, prettyStructured ,2)
facts = [ ...
master="master.inf.puppet.vm"
# copy what will be pluginsync'd to non-root agents to avoid some overhead (still checksum overhead, but no file copy over network).
# we copy the lib and facts.d dirs
libcache="/tmp/libcache"
declare -a arr=("centos7" "server2012r2" "win-2016" "ubuntu1404" "ubuntu1604")
start_num=5
end_num=26
for i in "${arr[@]}"; do
#!/opt/puppetlabs/puppet/bin/ruby
require 'json'
puppet = '/opt/puppetlabs/bin/puppet'
today = %x(date +%Y-%m-%d).chomp
nodes_json = JSON.parse(%x(#{puppet} query 'nodes[certname] { deactivated is null }'))
nodes_list = nodes_json.map { |n| n.values }.flatten
@jpadams
jpadams / hiera.yaml
Last active November 15, 2017 14:27
---
version: 5
hierarchy:
- name: "Classifier Configuration Data"
data_hash: classifier_data
- name: yaml
data_hash: yaml_data
datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata
paths:
- "nodes/%{clientcert}.yaml"
---
resources:
File[/usr/local]:
parameters:
ensure:
system_value:
- :directory
seluser:
system_value:
- system_u
---
resources:
File[/usr/local]:
parameters:
ensure:
system_value:
- :directory
seluser:
system_value:
- system_u
---
resources:
File[/usr/local]:
parameters:
ensure:
system_value:
- :directory
seluser:
system_value:
- system_u