~narindergupta/opnfv/stable-R2

« back to all changes in this revision

Viewing changes to ci/03-maasdeploy.sh

  • Committer: Narinder Gupta
  • Date: 2017-12-15 20:40:08 UTC
  • Revision ID: git-v1:f4b70aa06da6821c12a03d9b960af19468fac073
added bionic support with snap deployment. Alos fixes.

Change-Id: I6cf005194c7aff6845bfb749a45cd674531fedd4
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
sudo apt-get update -y || true
57
57
sudo apt-get install software-properties-common -y
58
58
 
59
 
if [ "$snapinstall" -eq 0 ]; then
 
59
if [ "$snapinstall" -eq "0" ]; then
60
60
    sudo apt-add-repository ppa:juju/stable -y
61
61
    sudo apt-add-repository ppa:maas/stable -y
62
62
fi
70
70
sudo apt-get update -y || true
71
71
#sudo apt-get dist-upgrade -y
72
72
 
73
 
if [ "$snapinstall" -eq 1 ]; then
 
73
if [ "$snapinstall" -eq "1" ]; then
74
74
    sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
75
75
             maas maas-region-controller juju python-pip python-psutil python-openstackclient \
76
76
             python-congressclient gsutil pastebinit python-jinja2 sshpass \
230
230
    sudo pip uninstall google-api-python-client
231
231
fi
232
232
 
233
 
if [ "$snapinstall" -eq 0 ]; then
234
 
    maasuser=maas
 
233
if [ "$snapinstall" -eq "0" ]; then
 
234
    if [ ! -e ~maas/.ssh/id_rsa.pub ]; then
 
235
        if [ ! -e $HOME/id_rsa_maas.pub ]; then
 
236
            [ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas
 
237
            sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
 
238
        fi
 
239
        sudo -u maas mkdir ~maas/.ssh/ || true
 
240
        sudo cp $HOME/id_rsa_maas ~maas/.ssh/id_rsa
 
241
        sudo cp $HOME/id_rsa_maas.pub ~maas/.ssh/id_rsa.pub
 
242
        sudo chown maas:maas ~maas/.ssh/id_rsa
 
243
        sudo chown maas:maas ~maas/.ssh/id_rsa.pub
 
244
        sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
 
245
    fi
235
246
else
236
 
    maasuser=root
237
 
fi
238
 
 
239
 
if [ ! -e ~$maasuser/.ssh/id_rsa.pub ]; then
240
 
    if [ ! -e $HOME/id_rsa_maas.pub ]; then
241
 
        [ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas
242
 
        sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
 
247
    if [ ! -e /root/.ssh/id_rsa.pub ]; then
 
248
        if [ ! -e $HOME/id_rsa_maas.pub ]; then
 
249
            [ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas
 
250
            sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
 
251
        fi
 
252
        sudo -u root mkdir /root/.ssh/ || true
 
253
        sudo cp $HOME/id_rsa_maas /root/.ssh/id_rsa
 
254
        sudo cp $HOME/id_rsa_maas.pub /root/.ssh/id_rsa.pub
 
255
        sudo chown root:root /root/.ssh/id_rsa
 
256
        sudo chown root:root /root/.ssh/id_rsa.pub
 
257
        sudo cat /root/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
243
258
    fi
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
249
259
fi
250
260
 
251
261
# Ensure virsh can connect without ssh auth
252
 
sudo cat ~$maasuser/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
253
262
sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
254
263
 
255
 
if [ "$snapinstall" -eq 1 ]; then
 
264
if [ "$snapinstall" -eq "1" ]; then
256
265
    sudo maas init --mode all --maas-url http://$MAAS_IP:5240/MAAS --admin-username $PROFILE \
257
266
                   --admin-password $PROFILE --admin-email ubuntu@ubuntu.com || true
258
267
    API_KEY=`sudo maas apikey --username=$PROFILE`
284
293
    maas $PROFILE tags create name='opnfv-dpdk' comment='OPNFV DPDK enablement' \
285
294
         kernel_opts='hugepagesz=2M hugepages=1024 hugepagesz=1G hugepages=20 default_hugepagesz=1G intel_iommu=on' || true
286
295
 
 
296
    maas $PROFILE package-repositories create name="Ubuntu  Proposed new" \
 
297
         url="http://archive.ubuntu.com/ubuntu" components="main" \
 
298
         distributions="xenial-proposed" arches=amd64,i386
 
299
 
287
300
    #create the required spaces.
288
301
    maas $PROFILE space update 0 name=default || true
289
302
    for space in admin-api internal-api public-api \
301
314
        maas $PROFILE boot-source-selection update 1 1 arches="$NODE_ARCHES"
302
315
    fi
303
316
 
304
 
    if [ "$snapinstall" -eq 0 ]; then
 
317
    if [ "$snapinstall" -eq "0" ]; then
305
318
        maas $PROFILE boot-resources import || true
306
319
    fi
307
320