Create a gist now

Instantly share code, notes, and snippets.

@mjs /juju-db
Last active Sep 1, 2016

What would you like to do?
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