Monday, 13 November 2017

IBM Cloud Private - Tinkering with Vagrant

So I've been on a slow boat to IBM Cloud Private, over the past few weeks, and am continuing to self-enable in my "spare" time ( my formal enablement starts next week ).

Looking at this: -

IBM® Cloud Private architecture

it was clear that I really needed a few boxes onto which to actually install ICP.

Whilst it is possible to run everything on one box ( as per this IBM Cloud Private - My first foray ), I thought that I really should do things properly.

So, starting with Beast, which has 8 CPU cores, 32 GB RAM and a shed-load of disk, I decided to use Vagrant and Virtual Box to build out a few VMs, onto which I can then install/provision ICP.

PS As per the previous post, I'd already installed the right versions of Vagrant and Virtual Box

This is how I started: -

Create a directory into which I'm going to put my Vagrant configuration etc.

mkdir ~/foobar
cd ~/foobar

Create a default Vagrant configuration file - Vagrantfile

vagrant init

Amended the Vagrantfile to reflect my chosen Ubuntu image

Note - rather than the default of base - which isn't ever going to work :-)

sed -i'' 's/base/ubuntu\/trusty64/g' Vagrantfile

Instantiate the VM

vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL:
==> default: Adding box 'ubuntu/trusty64' (v20171106.0.0) for provider: virtualbox
    default: Downloading:
==> default: Successfully added box 'ubuntu/trusty64' (v20171106.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: foobar_default_1510584547514_91304
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: Inserting generated public key within guest...    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /home/hayd/foobar

And off we go, ready to play

I did a brief test: -

ssh vagrant@ -p 2222

to ensure that the VM was OK, but that's as far as I've got yet.

I need to assign some real IP addresses next time around, and then go for multiple VMs, perhaps bringing some automation to bear.

We shall see …..

One thing to note - as per the above, Vagrant kindly generated a public/private key pair for me, with the private key being located here: -

-rw------- 1 hayd hayd 1675 Nov 13 14:49 /home/hayd/foobar/.vagrant/machines/default/virtualbox/private_key

Therefore, I can access my new VM without a password: -

ssh -i /home/hayd/foobar/.vagrant/machines/default/virtualbox/private_key vagrant@ -p 2222
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-135-generic x86_64)

 * Documentation:

  System information as of Tue Nov 14 09:52:05 UTC 2017

  System load:  0.13              Processes:           76
  Usage of /:   3.6% of 39.34GB   Users logged in:     0
  Memory usage: 24%               IP address for eth0:
  Swap usage:   0%

  Graph this data and manage this system at:

  Get cloud support with Ubuntu Advantage Cloud Guest:

0 packages can be updated.
0 updates are security updates.

New release '16.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Tue Nov 14 09:52:05 2017 from

which is nice.

Also, for the record, I can see the VM using VirtualBox's own tools e.g.

vboxmanage list vms
"foobar_default_1510584547514_91304" {92e7e750-6c83-4b64-b8d2-2cf66df2f2c7}

vboxmanage list vms --long
Name:            foobar_default_1510584547514_91304
Groups:          /
Guest OS:        Ubuntu (64-bit)
UUID:            92e7e750-6c83-4b64-b8d2-2cf66df2f2c7
Config file:     /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/foobar_default_1510584547514_91304.vbox
Snapshot folder: /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/Snapshots
Log folder:      /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/Logs
Hardware UUID:   92e7e750-6c83-4b64-b8d2-2cf66df2f2c7
Memory size:     512MB
Page Fusion:     off
VRAM size:       12MB


No comments: