Skip to content

Instantly share code, notes, and snippets.

@raphink
Created March 25, 2016 13:35
Show Gist options
  • Save raphink/4c3b87b3fd23f57a34ac to your computer and use it in GitHub Desktop.
Save raphink/4c3b87b3fd23f57a34ac to your computer and use it in GitHub Desktop.
mco_site() {
local site=$1
local config=$HOME/.mcollective.d/$site/client.cfg
# "agent"
if test -z $MCOLLECTIVE_SSL_PRIVATE; then
key=$(sed -n "/plugin.ssl_client_private = \(.*\)/ s//\1/p" $config)
MCOLLECTIVE_SSL_PRIVATE=$(mktemp /tmp/mcokey.XXXXXX)
chmod 0600 $MCOLLECTIVE_SSL_PRIVATE
openssl rsa -in $key -out $MCOLLECTIVE_SSL_PRIVATE >/dev/null
fi
shift
MCOLLECTIVE_SSL_PRIVATE=$MCOLLECTIVE_SSL_PRIVATE mco "$@" --config $config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment