Created
April 11, 2019 05:31
-
-
Save justinstoller/6de7af7714b2b390a49591781bc14036 to your computer and use it in GitHub Desktop.
demo
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
curl -k \ | |
--key $(puppet config print hostprivkey) \ | |
--cert $(puppet config print hostcert) \ | |
--cacert $(puppet config print localcacert) \ | |
--url https://$(puppet config print server):8140/puppet/v4/catalog \ | |
-H 'Content-Type: application/json' \ | |
-d @$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
# basic-request | |
{ | |
"certname": "hc1qg8df73fy022.delivery.puppetlabs.net", | |
"environment": "production", | |
"persistence": { | |
"facts": false, | |
"catalog": false | |
} | |
} | |
# agent-request | |
{ | |
"certname": "g0ctlxewssekl0q.delivery.puppetlabs.net", | |
"environment": "production", | |
"persistence": { | |
"facts": false, | |
"catalog": false | |
} | |
} | |
# new-node-w-facts | |
{ | |
"certname": "foo-berry.delivery.puppetlabs.net", | |
"environment": "production", | |
"facts": { | |
"values": { | |
"twoberry": "shoeberry" | |
} | |
}, | |
"trusted_facts": { | |
"values": { | |
"oneberry": "hatberry" | |
} | |
}, | |
"persistence": { | |
"facts": true, | |
"catalog": true | |
} | |
} | |
# new-node-wo-facts | |
{ | |
"certname": "foo-berry.delivery.puppetlabs.net", | |
"environment": "production", | |
"persistence": { | |
"facts": false, | |
"catalog": false | |
} | |
} | |
# new-node-env | |
{ | |
"certname": "foo-berry.delivery.puppetlabs.net", | |
"environment": "dev", | |
"persistence": { | |
"facts": false, | |
"catalog": false | |
}, | |
"options": { | |
"prefer_requested_environment": true, | |
"capture_logs": true | |
} | |
} |
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
#!/bin/bash | |
uri="enterprise.delivery.puppetlabs.net/2019.1/ci-ready/" | |
version=`curl "${uri}/LATEST"` | |
distribution="puppet-enterprise-${version}-el-7-x86_64" | |
tar="${distribution}.tar" | |
wget "${uri}/${tar}" | |
tar -xf "$tar" | |
pushd "$distribution" | |
echo 1 | ./puppet-enterprise-installer | |
puppet agent -t && puppet agent -t | |
popd | |
mkdir demo | |
pushd demo | |
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 | |
chmod +x jq-linux64 | |
mv jq-linux64 /usr/local/bin/jq | |
wget .. | |
chmod +x get-catalog | |
wget .. | |
wget .. | |
wget .. | |
# On agent node | |
# curl -k https://hc1qg8df73fy022.delivery.puppetlabs.net:8140/packages/current/install.bash | sudo bash | |
# On server | |
# puppetserver ca sign --all | |
# On agent node | |
# puppet agent -t |
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
# production | |
node default { | |
$trusted_fact = $trusted['oneberry'] ? { | |
undef => 'nonexistant', | |
default => $trusted['oneberry'] | |
} | |
$fact = $facts['twoberry'] ? { | |
undef => 'neverbeen', | |
default => $facts['twoberry'] | |
} | |
notify { $trusted_fact : } | |
notify { $fact : } | |
} | |
# dev | |
node default { | |
$trusted_fact = $::nofact ? { | |
undef => 'nonexistant', | |
default => 'whoknows' | |
} | |
notify { $trusted_fact : } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment