This blog post is a short cheat sheet related to the setup of a supported environment when you use a tools virtual machine in context for the usage with iascable and the Terraform output.
Only these are the supported environments for a tools virtual machine. You can find more details here automation-solutions – runtimes.
- Multipass (Virtual Machine)
- Docker Desktop
We will follow the instructions for Multipass. The following steps are an extractions of the documentation with small changes when needed.
Step 1: Install Multipass on Mac with brew
brew install --cask multipass
- Example output:
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
...
==> Downloading https://github.com/canonical/multipass/releases/download/v1.10.1/multipass-1.10.1+mac-Darwin.pkg
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/114128199/13043209-0c28-44d3-9c8b-2
######################################################################## 100.0%
==> Installing Cask multipass
==> Running installer for multipass; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is multipass
installer: Installing at base path /
installer: The install was successful.
🍺 multipass was successfully installed!
Step 2: Download the cloud-init configuration
curl https://raw.githubusercontent.com/cloud-native-toolkit/sre-utilities/main/cloud-init/cli-tools.yaml --output cli-tools.yaml
- Example output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4625 100 4625 0 0 20935 0 --:--:-- --:--:-- --:--:-- 21919
Step 3: Start the virtual cli-tools
machine
multipass launch --name cli-tools --cloud-init ./cli-tools.yaml
- Example output:
Retrieving image: 95%
Verifying image: |
Preparing for cli-tools: |
Starting cli-tools /
Waiting for initialization to complete \
Launched: cli-tools
Step 4: Mount a local volume
multipass mount $PWD cli-tools:/automation
- Example output:
mount failed: source "/Users/user/Downloads/dev/example" is not readable
Solution you can find in the documentation and on stack-overflow. Here is an additional issue I created in that context.
Enabling support for mounting |
Step 5: Open an interactive shell to work with the mapped volume
multipass shell cli-tools
- Example output:
ubuntu@cli-tools:~$
Step 6: Navigate to the mapped volume and show the content of the folder
cd ../../automation
ls
Optional
Step 1: Verify the VM was created
multipass list
- Example output:
Name State IPv4 Image
cli-tools Running 192.168.64.5 Ubuntu 20.04 LTS
Step 2: Get some information related to the virtual machine
multipass info cli-tools
- Example output:
Name: cli-tools
State: Running
IPv4: 192.168.64.5
Release: Ubuntu 20.04.4 LTS
Image hash: 77f2f05e39e5 (Ubuntu 20.04 LTS)
Load: 0.08 0.02 0.03
Disk usage: 1.4G out of 4.7G
Memory usage: 158.5M out of 976.9M
Mounts: /Users/thomassuedbroecker/Downloads/example => /automation
UID map: 501:default
GID map: 20:default
Step 3: Stop virtual machine¶
multipass stop cli-tools
Step 4: Delete virtual machine
multipass delete cli-tools
multipass list
- Example output:
Name State IPv4 Image
cli-tools Deleted -- Not Available
Step 5: Remove virtual machine permanently
multipass purge
multipass list
- Example output
No instances found.
Additional information
Here is a link to a useful bash script that shows how to clean and restart an example VM: LINK
I hope this was useful to you and let’s see what’s next?
Greetings,
Thomas
#multipass, #macos
Leave a Reply