In this post, I’ll guide you through the seamless deployment of laboratory (lab) environments on VMware Fusion or Workstation using Vagrant. The primary objective is to create a versatile, multi-purpose lab environment ideal for testing cloud-native solutions, prototyping integrations, exploring automation, and refining workflows.

The importance of a Lab

A lab, whether it’s a full-scale environment, a miniaturized version, or a portable setup, holds significant value for infrastructure administrators, platform engineers, and developers. It serves as a crucial space for testing technologies before implementation in a production environment. While a lab is not a direct Proof of Concept (POC), it provides a controlled space for decision-making without impacting operational environments.

For this reason, a good lab should:

  1. go straight to the objective without wasting time with long and interactive installation processes
  2. repeatable, using a good automation level to reproduce, destroy, and rebuild the environments
  3. recoverable, the essential data should be protected in case of deep system corruption
  4. secure, with networking and infrastructure isolation from the production environment to avoid unwanted interactions and guarantee enough protection to work safely with your platform.

Acknowledgments

Special thanks to the vExpert program and Cohesity for providing the hardware: a fanless mini PC Maxtang NX 6412 equipped with an Intel Elkhart Lake J6412 Processor and 32 GB RAM. This “portable lab” serves various needs and can run on Windows or Linux or as a portable ESXi host. For those curious about setting up ESXi, refer to Vladan’s post here.

So here thanks again to Cohesity and the vExpert program for this gift!

Note: the following “instructions” can be applied also to other systems, like Mac or different mini servers. Just minds to have enough CPU and Memory to run an Intel Virtual Machine with 2vCPU and 8GB RAM.

Getting started!

Following the ingredients:

After installing VMware Workstation or Fusion, the next step is to prepare your environment for automation. Follow these steps:

  1. Install Vagrant Community and Vagrant VMware Utility:
  2. Set Up Git CLI and Visual Studio Code:
  3. Clone the Repository:
    • Use Git CLI to clone the lab setup repository: git clone https://github.com/linoproject/basic_lab_setup

Then you’re ready to deploy the first lab.

Automation with Vagrant, Terraform, Ansible, …

One interesting thing behind the automation/configuration management/infrastructure as code tools is the extensive use of the following tools:

  • Drone: an extremely lightweight pipeline tool that, depending on the size in terms of automation tasks can run in Docker, Kubernetes, and GitLab. With a simple YAML and a Docker/Podman instance, it’s possible to easily run pipelines and execute tasks based on containers.
  • Ansible: one of the most famous configuration management systems and automation tools with a huge collection of playbooks and extensions (https://docs.ansible.com/ansible/latest/collections/index.html)
  • Terraform: the standard de-facto of Infrastructure as Code, able to deliver infrastructure elements across all clouds and all platforms. In this lab, we’re gonna use the CLI version (free to use and implemented as-is)
  • Other tools: in the next post I’ll use some other tools and platforms… from now I will include Docker, Minikube, and HAProxy

In this lab all of these tools are installed in the following way:

  1. Vagrant installs Ansible in the remote VM (This is to avoid the Vagrant and Ansible local interaction which is not well supported by Windows host systems).
    1. $script = <<-'SCRIPT'
              if [ ! -d "/vagrant" ]; then 
                  mkdir /vagrant
              fi    
      
              if [ ! -d "/ansible" ]; then 
                  mkdir /ansible 
                  apt-get -y update && apt-get -y upgrade
                  apt-get install -y python3 python3-pip python3.10-venv
                  apt-add-repository ppa:ansible/ansible && apt update && apt install -y ansible
              fi
              if [ ! -d "/home/vagrant/.ansible" ]; 
                  then mkdir /home/vagrant/.ansible 
              fi 
              chown vagrant:vagrant /home/vagrant/.ansible
          SCRIPT
          config.vm.provision "shell",
              inline: $script
  2. Drone, Terraform, and other utilities are provided by playbook files which are uploaded to the remote VM
  3. Ansible in the remote VM reconciles with the content of the playbook files.
    1. config.vm.provision "ansible_local" do |ansible|
              ansible.verbose = "v"
              ansible.playbook = "ansible_docker.yaml"
          end

Lab up!

To run this lab just clone the repo https://github.com/linoproject/basic_lab_setup and type

vagrant up

to build and start the basic lab.

Congratulations! You’ve successfully set up your laboratory environment. If you have any questions, feedback, or suggestions for improvements, feel free to contact me on X (@linotelera).

In the upcoming posts, we’ll explore this lab in greater depth, exploring various technologies, automation techniques, and enhancements. If you have specific topics you’d like to see covered or interesting cases to share, don’t hesitate to contact us.

Enjoy your lab!

By admin

One thought on “Lab Time: Setup with Vagrant on VMware Fusion/Workstation”

Comments are closed.

Utilizzando il sito, accetti l'utilizzo dei cookie da parte nostra. Using this site you accept cooking utilization. maggiori informazioni more Informations

Questo sito utilizza i cookie per fornire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o cliccando su "Accetta" permetti il loro utilizzo. This site uses cookies to provide the best browsing experience possible. By continuing to use this website without changing your cookie settings or clicking "Accept" allow their use.

Chiudi Close