vchepkov
08/08/2022, 2:12 PMclass foo (
$base_port,
$secure_port = $base_port + 1000,
silug
08/08/2022, 2:26 PMsecure_port
default in hiera toorunlolarun
08/08/2022, 2:44 PMpuppet node clean *.<http://domain.edu|domain.edu>
?runlolarun
08/08/2022, 2:44 PMpuppet node clean *.<http://domain.edu|domain.edu>
?vchepkov
08/08/2022, 2:50 PMvchepkov
08/08/2022, 2:51 PMpuppetserver ca list --all|grep pattern
vchepkov
08/08/2022, 2:52 PMrunlolarun
08/08/2022, 3:03 PMYorokobi
08/08/2022, 3:07 PMrunlolarun
08/08/2022, 3:10 PMSkylar Thompson
08/08/2022, 3:17 PMpuppet node clean
can take in multiple node names, so could do something like this with xargs
(remove echo
when you're sure the output is right 🙂 ) - sudo puppetserver ca list --all|awk '$1 ~ /\.your-domain-here\.edu/ {print $1}'|xargs echo puppet node clean
Skylar Thompson
08/08/2022, 3:18 PMwhile
loop, depending on how many nodes you're working onvchepkov
08/08/2022, 3:20 PMpuppet node clean
thing of the past?vchepkov
08/08/2022, 3:21 PMpuppetserver ca clean --certname cert1,cert2
nowSlackbot
08/08/2022, 3:21 PMSlackbot
08/08/2022, 3:21 PMRobert Vincent
08/08/2022, 3:21 PM#!/bin/bash
usage() {
echo 'Usage:'
echo "$0 <FQDN> [[<FQDN>]]"
exit 1
}
# Exit with failure if no argument is given.
[[ $# -lt 1 ]] && usage
#
# Strip tabs, returns, and linefeeds from arguments.
ARGS="${*//[$'\t\r\n']}"
# Convert to lowercase.
CERTS="${ARGS,,}"
# Combine into comma-delimited list.
LIST="${CERTS// /,}"
# Puppet primary hostname
MOM=$(facter -p puppet_master_server)
# Delete the node(s)
TASK='/opt/puppetlabs/bin/puppet task run support_tasks::st0317b_purge_node'
PARAMS="agent_certnames=${LIST} -n ${MOM}"
echo "${TASK} ${PARAMS}" | tee -a $LOGFILE
$TASK $PARAMS | sed -e '/^$/d; :x /\s*:\s*$/ { N; s/\s*:\s*\n\s*/ : /g ; bx }'
Robert Vincent
08/08/2022, 3:22 PM#!/bin/bash
usage() {
echo 'Usage:'
echo "$0 <FQDN> [[<FQDN>]]"
exit 1
}
# Exit with failure if no argument is given.
[[ $# -lt 1 ]] && usage
#
# Strip tabs, returns, and linefeeds from arguments.
ARGS="${*//[$'\t\r\n']}"
# Convert to lowercase.
CERTS="${ARGS,,}"
# Combine into comma-delimited list.
LIST="${CERTS// /,}"
# Puppet primary hostname
MOM=$(facter -p puppet_master_server)
# Delete the node(s)
TASK='/opt/puppetlabs/bin/puppet task run support_tasks::st0317b_purge_node'
PARAMS="agent_certnames=${LIST} -n ${MOM}"
echo "${TASK} ${PARAMS}"
$TASK $PARAMS | sed -e '/^$/d; :x /\s*:\s*$/ { N; s/\s*:\s*\n\s*/ : /g ; bx }'
Robert Vincent
08/08/2022, 3:32 PM#!/bin/bash
usage() {
echo 'Usage:'
echo "$0 <FQDN> [[<FQDN>]]"
exit 1
}
# Exit with failure if no argument is given.
[[ $# -lt 1 ]] && usage
#
# Strip tabs, returns, and linefeeds from arguments.
ARGS="${*//[$'\t\r\n']}"
# Convert to lowercase.
CERTS="${ARGS,,}"
# Combine into comma-delimited list.
LIST="${CERTS// /,}"
# Puppet primary hostname
PRI=$(facter -p puppet_master_server)
# Delete the node(s)
TASK='/opt/puppetlabs/bin/puppet task run support_tasks::st0317b_purge_node'
PARAMS="agent_certnames=${LIST} -n ${PRI}"
echo "${TASK} ${PARAMS}"
$TASK $PARAMS | sed -e '/^$/d; :x /\s*:\s*$/ { N; s/\s*:\s*\n\s*/ : /g ; bx }'
# Run cleanup task on Compile Masters
/opt/puppetlabs/bin/puppet job run -q "
resources {
type = 'Class' and
title = 'Puppet_enterprise::Profile::Master' and
!(certname = '${PRI}')
}
"
Gerard Ryan
08/08/2022, 3:53 PMvchepkov
08/08/2022, 3:55 PMGerard Ryan
08/08/2022, 3:55 PMvchepkov
08/08/2022, 3:55 PMGerard Ryan
08/08/2022, 3:55 PMGerard Ryan
08/08/2022, 3:57 PMGerard Ryan
08/08/2022, 3:58 PMvchepkov
08/08/2022, 3:59 PMvchepkov
08/08/2022, 4:00 PMGerard Ryan
08/08/2022, 4:02 PMSlackbot
08/08/2022, 4:04 PM