Vagrant project
Categories:
A Vagrant project is a directory structure that uses Vagrant to define and manage virtual development environments. It includes a Vagrantfile for declarative configuration of virtual machines, networks, and provisioning steps. The Ansible mirror inventory project is a prime example of a Vagrant project.
In the C2 Platform context, a Vagrant project integrates with Ansible automation to simulate real-world infrastructure locally. It is designed for testing Ansible content ( Ansible collections, Ansible roles, etc.) and mirror inventory projects. This promotes consistency and repeatability in development environments, enabling Ansible engineers to prototype and validate automation. The Ansible content is then published to Ansible Galaxy for use in automation across Dutch government domains and data centers.
In the C2 Platform approach, a Vagrant project is always also an
Ansible mirror inventory project. It uses a generic
Vagrantfile
complemented by a Vagrantfile.yml YAML file, which defines the development
environment’s nodes, networks, and other configurations. The YAML file is used
to abstract away some of the complexity associated with configuring a
Vagrantfile for systems consisting of many nodes, including multiple LXD
containers and some VirtualBox VMs. This approach simplifies management by
separating configuration data from the core Vagrant logic, making it easier to
maintain and scale the environment.
For an example of a Vagrant project, see the
inventory project
RWS GIS Platform Ansible Mirror Inventory Project ( c2platform/rws/ansible-gis).
This project contains a
Vagrantfile
that is accompanied by a YAML configuration file
Vagrantfile.yml.
Creating a new node is as simple as copying and modifying a bit of YAML code. In
the snippet below, node gsd-fme-core is defined. So creating a new node in
your environment is as simple as copying those lines and making some changes,
giving a unique name, unique IP, etc., and choosing a Vagrant box. For example,
note that the box for this node is configured as win2022.
191 - name: fme-core
192 description: FME
193 box: win2022
194 ip-address: 1.1.8.106
195 memory: 4500
196 aliases:
197 - share.internal.c2platform.org
198 - gsd-fme-core.internal.c2platform.org
199 - gsd-fme-core.apps.c2platform.org
200 plays:
201 - gis/fme
In the snippet below, we see some of the available Vagrant boxes. For
instance, gsd-fme-core uses win2022, which is configured for
sysprep (via the key sysprep: true) and uses WinRM for communication
(via the key vm-communicator: winrm). RHEL 8 and 9 boxes are also defined,
with registration: true ensuring automatic registration with Red Hat
upon creation and deregistration upon destruction.
299boxes: # https://app.vagrantup.com/c2platform/
300 ubuntu22-lxd:
301 name: c2platform/ubuntu-jammy
302 version: 0.1.0
303 provider: lxd
304 win2022:
305 name: c2platform/win2022
306 version: 0.1.0
307 sysprep: true
308 vm-communicator: winrm
309 rhel8:
310 name: generic/rhel8
311 version: 4.3.12
312 registration: true
313 rhel9:
314 name: generic/rhel9
315 version: 4.3.12
316 registration: true
Numerous optimizations and enhancements have been made to the C2 Vagrant project setup over the years.
Additional Information
- Ansible Mirror Inventory Project: An open-source specialized Ansible inventory project that integrates Vagrant functionality to simulate real-world infrastructure locally for development and testing.
- Automating RHEL Registration and Subscription: Automate Red Hat Enterprise Linux (RHEL) registration and subscription in C2 Platform development environments using Vagrant for seamless access to Red Hat resources.
- Install Vagrant and Vagrant Plugins: Install Vagrant, Vagrant plugin
vagrant-lxd,vagrant-windows-sysprepand enable Vagrant autocomplete.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.