roq-vagrant repository is useful as a template, if you want to validate a specific
configuration using a virtual machine.
A number of Linux distributions have been set up
CentOS 7 and 8
Debian 9 and 10
Ubuntu 18.04 and 20.04
These scripts are used to test roq-ansible (Ansible Roles) with different assumptions about Linux environments.
The latest major releases are typically being tested for a selection of Linux distributions.
Vagrant uses a
Vagrantfile to configure the virtual machine, including
an optional script for provisioning.
For example, the Ubuntu 18.04 Vagrantfile may look similar to this
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.define "vm_test" config.vm.network "private_network", ip: "192.168.33.200" config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] vb.memory = "4096" vb.cpus = 4 end config.vm.network "forwarded_port", guest: 80, host: 10080 config.vm.provision "shell" do |shell| shell.inline = "apt-get update && apt-get install -y python" end config.vm.provision "ansible" do |ansible| ansible.inventory_path = "../vm_test" ansible.playbook = "../site.yml" end end
The assumption is that you are in this directory and your environment has access to
Then you can simply start the virtual machine by typings this
$ vagrant up
This will take some time!
The provisioning may fail (network timeout or other transient issue), in which case you can attempt to continue
$ vagrant provision
Once completed successfully, you can access your virtual machine
$ vagrant ssh
Finally, you can instruct your virtual machine to stop
$ vagrant halt