Skip to content

Instantly share code, notes, and snippets.

@mjs
Last active September 1, 2016 21:56
Show Gist options
  • Save mjs/0d0b89356654de04adf4935860642c5f to your computer and use it in GitHub Desktop.
Save mjs/0d0b89356654de04adf4935860642c5f to your computer and use it in GitHub Desktop.
Helper to get a MongoDB shell on a Juju controller
#!/bin/bash
model=${1:-controller}
machine=${2:-0}
read -d '' -r cmds <<'EOF'
password=`sudo grep oldpassword /var/lib/juju/agents/machine-*/agent.conf | cut -d' ' -f2`
/usr/lib/juju/mongo*/bin/mongo 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "admin" --password "$password"
EOF
juju ssh -m $model $machine "$cmds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment