Commit ab7b4e5d authored by Cool Fire's avatar Cool Fire
Browse files

Update instructions to use contrib-stretch

This image already includes the vboxfs drivers we need for provisioning
so we don't need to install them by hand anymore.
parent ea5f828f
Pipeline #1312 passed with stages
in 9 minutes and 39 seconds
......@@ -44,7 +44,7 @@ Paste this into your hiera.yaml file and your hieradata structure should be comp
# Testing
Vagrant and Virtualbox are used for testing changes. Changes are tested on the debian/stretch64 image.
Vagrant and Virtualbox are used for testing changes. Changes are tested on the debian/contrib-stretch64 image.
## Setting up a new vagrant box
......@@ -52,14 +52,14 @@ If you are already using vagrant and know how to configure a box, you can skip t
First make sure you have both virtualbox and vagrant installed of course, then to create a new vagrant box run the following commands
```
vagrant init debian/stretch64
vagrant init debian/contrib-stretch64
vagrant up
```
This will set up a new Vagrantfile and download the box for you. Once this is done run `vagrant halt` to stop the VM again, since we need to make some tweaks to the Vagrantfile in order to make it work with puppet. If your Vagrantfile was newly generated by the vagrant init command you can use this one instead, otherwise make sure you add any missing config options to your existing Vagrantfile.
```
Vagrant.configure(2) do |config|
config.vm.box = "debian/stretch64"
config.vm.box = "debian/contrib-stretch64"
config.vm.synced_folder "hieradata", "/tmp/vagrant-puppet/hieradata"
config.vm.provision "puppet", :options => ["--yamldir /hieradata"] do |puppet|
puppet.hiera_config_path = "hiera.yaml"
......@@ -75,29 +75,6 @@ If you do not have a default.pp manifest, create a blank one now.
touch manifests/default.pp
```
The vagrant box still needs to have the Virtualbox guest additions installed in order to automatically mount our puppet code repositories and intergrate nicely, so we now have to start the Virtualbox GUI and run our puppet VM. It should be called something like `puppet_default_[some big number]`.
First we need to give it a CD drive to instert the image into. Open the VM's settings, go to "Storage" and click the SATA controller and then the "Add optical drive" button that appears next to it. You can pick the "Leave empty" option when it asks you for a disk image.
You can now start the VM as you would any other Virtualbox VM. Let it boot and log in with the default credentials. (User: vagrant, pass: vagrant). Now form the Virtualbox "Devices" menu, pick the "Insert Guest additions CD image..." option. Now we can mount it inside our virualbox VM. We'll mount it to /mnt for now because we're lazy and it's easy.
```
sudo mount /dev/sr0 /mnt
```
First we need to install a few dependencies for the guest additions installer to run.
```
sudo apt install gcc make perl linux-headers-amd64
```
Once that is done we can run the Virtualbox Guest additions installer.
```
sudo /mnt/VBoxLinuxAdditions.run
```
Once that is finished too, we finally have a Virtualbox image that will work with our puppet install! You can run `sudo shutdown` from the Virtualbox console window to stop the VM. You can also take this moment to remove the CD drive from the VM again, but you don't have to, it should not interfere with anything.
Since we don't want to do this again, this would also be a great time to take a snapshot of the VM so we can roll back to it again later in case anything breaks. You can do this directly from the Virtualbox GUI. (You can also do it from vagrant, but the GUI is just a nice simple click.)
Now lets test our vagrant box. Run `vagrant up` from your terminal and make sure you are in the same directory as you Vagrantfile and the base of the puppet repo. If all goes well it should boot in a few seconds.
Now we'll connect to the VM over ssh. Use the `vagrant ssh` command, this should drop you into an ssh session inside the VM.
......@@ -123,7 +100,7 @@ sudo apt update
sudo apt install puppet-agent
```
GREAT! That's finally all we need to do to start testing stuff in vagrant. We'll shut down the VM and make another snapshot of the VM here so we never have to do this ever again.
GREAT! That's finally all we need to do to start testing stuff in vagrant. This would be a good time to go into the Virtualbox GUI and make a quick snapshot of the box so we never have to do all that again.
## Testing puppet code inside vagrant
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment