24
opnfvdistro=`cat /etc/lsb-release | grep CODENAME | cut -d "=" -f 2`
28
opnfvdistro=`cat /etc/lsb-release | grep CODENAME | cut -d "=" -f 2`
30
if [ "bionic" == "$opnfvdistro" ]; then
29
35
if [ ! -e $HOME/.ssh/id_rsa ]; then
30
36
ssh-keygen -N '' -f $HOME/.ssh/id_rsa
49
55
#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA
50
56
sudo apt-get update -y || true
51
57
sudo apt-get install software-properties-common -y
52
sudo apt-add-repository ppa:juju/stable -y
53
sudo apt-add-repository ppa:maas/stable -y
54
if [ "bionic" == "$opnfvdistro" ]; then
55
echo "no cloud archive needed"
57
sudo apt-add-repository cloud-archive:pike -y
59
if [ "$snapinstall" -eq 0 ]; then
60
sudo apt-add-repository ppa:juju/stable -y
61
sudo apt-add-repository ppa:maas/stable -y
60
if [ "aarch64" == "$NODE_ARCTYPE" ]; then
61
if [ "bionic" == "$opnfvdistro" ]; then
62
echo "no repository needed"
63
if [ "bionic" != "$opnfvdistro" ]; then
64
sudo apt-add-repository cloud-archive:pike -y
65
if [ "aarch64" == "$NODE_ARCTYPE" ]; then
64
66
sudo add-apt-repository ppa:ubuntu-cloud-archive/pike-staging -y
67
70
sudo apt-get update -y || true
68
71
#sudo apt-get dist-upgrade -y
70
if [ "bionic" == "$opnfvdistro" ]; then
73
if [ "$snapinstall" -eq 1 ]; then
71
74
sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
72
75
maas maas-region-controller juju python-pip python-psutil python-openstackclient \
73
76
python-congressclient gsutil pastebinit python-jinja2 sshpass \
74
77
openssh-server vlan ipmitool jq expect snap -y --allow-unauthenticated
75
79
sudo snap install charm
80
sudo snap install --devmode --stable maas
77
82
sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
78
83
maas maas-region-controller juju python-pip python-psutil python-openstackclient \
227
230
sudo pip uninstall google-api-python-client
233
if [ "$snapinstall" -eq 0 ]; then
231
if [ ! -e ~maas/.ssh/id_rsa.pub ]; then
239
if [ ! -e ~$maasuser/.ssh/id_rsa.pub ]; then
232
240
if [ ! -e $HOME/id_rsa_maas.pub ]; then
233
241
[ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas
234
242
sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
236
sudo -u maas mkdir ~maas/.ssh/ || true
237
sudo cp $HOME/id_rsa_maas ~maas/.ssh/id_rsa
238
sudo cp $HOME/id_rsa_maas.pub ~maas/.ssh/id_rsa.pub
239
sudo chown maas:maas ~maas/.ssh/id_rsa
240
sudo chown maas:maas ~maas/.ssh/id_rsa.pub
244
sudo -u $maasuser mkdir ~$maasuser/.ssh/ || true
245
sudo cp $HOME/id_rsa_maas ~$maasuser/.ssh/id_rsa
246
sudo cp $HOME/id_rsa_maas.pub ~$maasuser/.ssh/id_rsa.pub
247
sudo chown $maasuser:$maasuser ~$maasuser/.ssh/id_rsa
248
sudo chown $maasuser:$maasuser ~$maasuser/.ssh/id_rsa.pub
243
251
# Ensure virsh can connect without ssh auth
244
sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
252
sudo cat ~$maasuser/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
245
253
sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
255
if [ "$snapinstall" -eq 1 ]; then
256
sudo maas init --mode all --maas-url http://$MAAS_IP:5240/MAAS --admin-username $PROFILE \
257
--admin-password $PROFILE --admin-email ubuntu@ubuntu.com || true
258
API_KEY=`sudo maas apikey --username=$PROFILE`
260
sudo maas-rack config --region-url http://$MAAS_IP:5240/MAAS
261
sudo maas createadmin --username=$PROFILE --email=ubuntu@ubuntu.com --password=$PROFILE || true
262
API_KEY=`sudo maas-region apikey --username=$PROFILE`
249
266
# https://insights.ubuntu.com/2016/01/23/maas-setup-deploying-openstack-on-maas-1-9-with-juju/
253
270
#reconfigure maas with correct MAAS address.
255
sudo maas-rack config --region-url http://$MAAS_IP:5240/MAAS
257
sudo maas createadmin --username=ubuntu --email=ubuntu@ubuntu.com --password=ubuntu || true
258
API_KEY=`sudo maas-region apikey --username=ubuntu`
259
271
maas login $PROFILE $API_SERVERMAAS $API_KEY
260
272
maas $PROFILE maas set-config name='main_archive' value=$MAIN_ARCHIVE || true
261
273
maas $PROFILE maas set-config name=upstream_dns value=$MY_UPSTREAM_DNS || true
289
301
maas $PROFILE boot-source-selection update 1 1 arches="$NODE_ARCHES"
292
maas $PROFILE boot-resources import || true
304
if [ "$snapinstall" -eq 0 ]; then
305
maas $PROFILE boot-resources import || true
294
308
while [ "$(maas $PROFILE boot-resources is-importing)" == "true" ];
590
602
setupspacenetwork
592
sudo sed -i 's/localhost/'$MAAS_IP'/g' /etc/maas/rackd.conf
593
sudo service maas-rackd restart
594
sudo service maas-regiond restart
604
if [ "$snapinstall" -eq 0 ]; then
605
sudo sed -i 's/localhost/'$MAAS_IP'/g' /etc/maas/rackd.conf
606
sudo service maas-rackd restart
607
sudo service maas-regiond restart
598
611
# Let's add the nodes now. Currently works only for virtual deployment.
605
618
#maas $PROFILE sshkeys new key="`cat ./maas/sshkeys/DominoKey.pub`"
607
620
addcredential() {
608
API_KEY=`sudo maas-region apikey --username=ubuntu`
609
621
controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
610
622
cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`