From 4e70fbcec644fa6fd86a0053e2f2a9b2f3f713a0 Mon Sep 17 00:00:00 2001
From: Scott Solkhon <scottsolkhon@gmail.com>
Date: Mon, 18 May 2020 22:23:07 +0100
Subject: [PATCH] Upgrade Vagrant VM to CentOS 8

This commit upgrades the development Vagrant vm to use
CentOS 8.

This also increases the size of the root disk as the
CentOS 8 cloud image is only 10GB which is not
sufficient for a Kayobe deployment.

Change-Id: I614cf6e0a774229da30831e806e2ae125e5cf0fb
---
 Vagrantfile                        | 20 +++++++++++++++++---
 doc/source/development/vagrant.rst | 10 +++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 4d4affa3..4df345bd 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -6,8 +6,11 @@ Vagrant.configure('2') do |config|
 
   config.vm.network 'private_network', ip: '192.168.33.3', auto_config: false
 
-  config.vm.box = 'stackhpc/centos-7'
-  config.vm.box_version = '0.2.0'
+  config.vm.box = 'centos/8'
+
+  # The default CentOS box comes with a root disk that is too small to fit a
+  # deployment on so we need to make it bigger.
+  config.disksize.size = '20GB'
 
   config.vm.provider 'virtualbox' do |vb|
     vb.memory = '4096'
@@ -21,6 +24,18 @@ Vagrant.configure('2') do |config|
   end
 
   config.vm.provision 'shell', inline: <<-SHELL
+
+    # Extend the root disk
+    sudo parted "/dev/sda" ---pretend-input-tty <<EOF
+resizepart
+1
+100%
+Yes
+-0
+quit
+EOF
+    sudo xfs_growfs -d /
+
     echo "cat > /etc/selinux/config << EOF
 SELINUX=disabled
 SELINUXTYPE=targeted
@@ -40,7 +55,6 @@ BOOTPROTO=none
 IPADDR=192.168.33.3
 NETMASK=255.255.255.0
 ONBOOT=yes
-NM_CONTROLLED=no
 EOF
     sudo ifup eth1
 
diff --git a/doc/source/development/vagrant.rst b/doc/source/development/vagrant.rst
index 5955f69d..d54947da 100644
--- a/doc/source/development/vagrant.rst
+++ b/doc/source/development/vagrant.rst
@@ -5,23 +5,23 @@ Vagrant
 =======
 
 Kayobe provides a Vagrantfile that can be used to bring up a virtual machine
-for use as a development environment. The VM is based on the `stackhpc/centos-7
-<https://app.vagrantup.com/stackhpc/boxes/centos-7>`_ CentOS 7 image, and
+for use as a development environment. The VM is based on the `centos/8
+<https://app.vagrantup.com/centos/boxes/8>`_ CentOS 8 image, and
 supports the following providers:
 
 * VirtualBox
 * VMWare Fusion
 
-The VM is configured with 4GB RAM. It has a single private network in addition
+The VM is configured with 4GB RAM and a 20GB HDD. It has a single private network in addition
 to the standard Vagrant NAT network.
 
 Preparation
 ===========
 
 First, ensure that Vagrant is installed and correctly configured to use
-the required provider. Also install the following vagrant plugin::
+the required provider. Also install the following vagrant plugins::
 
-    vagrant plugin install vagrant-reload
+    vagrant plugin install vagrant-reload vagrant-disksize
 
 If using the VirtualBox provider, install the following vagrant plugin::
 
-- 
GitLab