Ubuntu Juju controller bootstrap manual provisioning

by ziphub
25 deployments · 11 still active · last rev. 2 years ago

Everything you need to get started with Juju. Make sure the the fqdn is set. to use the juju cli, just su to juju, or use the web interface.

Compatible with: Ubuntu 12.04 LTS, Ubuntu 14.04 LTS
# <UDF name="fqdn" Label="Fully Qualified Domain Name" />
# <UDF name="console_password" Label="Juju admin console password" />
# Juju bootstrap for Linode.  Ubuntu 12.04.5 tested.  Configured for Manual Provision.
# Stephanie Sunshine <sms@ziphub.com>
logger System Installing Juju

source <ssinclude StackScriptID=1>

system_set_hostname "$FQDN"

apt-get update && apt-get -y install python-software-properties && add-apt-repository -y ppa:juju/stable && apt-get update && apt-get -y install juju-core && apt-get -y upgrade

logger System Create the juju user
groupadd juju && useradd -d /home/juju -g juju -m -s /bin/bash juju

logger System Give the user juju temp full access
echo 'juju ALL=NOPASSWD: ALL' > /etc/sudoers.d/juju
chmod 0440 /etc/sudoers.d/juju

logger System Generate SSH keys
su -l -c 'ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -N ""' juju
su -l -c 'cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2' juju

logger System Generate juju config
su -l -c 'juju generate-config' juju
su -l -c 'juju switch manual' juju

logger System Update environments.yaml for our needs
su -l -c "sed -i \"/type\: manual$/ a\        admin-secret: $CONSOLE_PASSWORD\" ~/.juju/environments.yaml" juju
su -l -c "sed -i \"s/somehost.example.com/$FQDN/\" ~/.juju/environments.yaml" juju

logger System Bootstrap
su -l -c 'juju bootstrap' juju

#If you don't want the GUI, disable this
logger System Installing juju gui
su -l -c 'juju deploy cs:precise/juju-gui --to 0' juju
su -l -c 'juju expose juju-gui' juju

logger System Remove juju from sudo
rm -f /etc/sudoers.d/juju

logger System Stack script juju install complete