Using Block Storage

In this lab you’ll create a VM with additional attached block storage. Unlike previous labs you will have to research how to do this using Terraform and Ansible. This lab is important preparation for the project, which requires that you add a persistent disk for data.

Class Lecutre

In the class lecture we created a VM and added additional block storage. Once present we formatted and mounted the additional disk. This is the basic procedure that you will implement using code.

Block Devices

Add the following storage to your VM:

  1. Zonal persistent disk:

    • Mount point: /data

    • Capacity: 100GB

    • Class: Any storage class

    • Filesystem: ext4

  2. (Extra Credit) Local attached SSD

    • Mount point: /scratch

    • Capacity: 375GB

    • Filesystem: ext4

Make a lab10 Directory

In your git repository, create copy the base directory to create a new directory for this lab.

$ cp -R base lab10
$ cd lab10

Researching Terraform

Your Terraform configuration should build on the base configuration by adding the persistent disks. Research the necessary resources on Terraform’s documentation:

https://registry.terraform.io/providers/hashicorp/google/latest/docs

It’s sometimes helpful to reverse-engineer a system created through the GUI.

Researching Ansible

Ansible is required to format and mount the disks. Your ansible playbook should have tasks that do this. You can search for the plugins you need on Ansible’s documentation page:

https://docs.ansible.com/ansible/latest/

It’s also helpful to Google things like “format a disk with Ansible” to find the right plugins and examples.

Turn In

Turn in your configuration and playbook files:

  1. main.tf

  2. playbook.yaml