Ansible will be installed by Vagrant in the VM and will then provision the machine from within, making the Windows Subsystem for Linux obsolete. The Vagrant host (Windows 10) only has to have Vagrant installed.
84 lines
No EOL
4.1 KiB
Ruby
84 lines
No EOL
4.1 KiB
Ruby
# This guide is optimized for Vagrant 1.8 and above.
|
|
# Older versions of Vagrant put less info in the inventory they generate.
|
|
Vagrant.require_version ">= 1.8.0"
|
|
|
|
require 'etc'
|
|
|
|
Vagrant.configure(2) do |config|
|
|
|
|
config.vm.box = "hashicorp/bionic64"
|
|
|
|
# The currently only supported provider is Virtualbox
|
|
# You will have to install Virtualbox from https://www.virtualbox.org
|
|
# Manual for the following settings: https://www.virtualbox.org/manual/ch03.html
|
|
config.vm.provider :virtualbox do |vbox, override|
|
|
vbox.customize ["modifyvm", :id, "--name", "Self-host All The Things! - Dev VM"]
|
|
# Amount of virtual memory
|
|
vbox.customize ["modifyvm", :id, "--memory", 8192]
|
|
# Amount of virtual CPUs, by default it uses half ot the physical CPUs
|
|
vbox.customize ["modifyvm", :id, "--cpus", Etc.nprocessors/2]
|
|
# The amount of graphics memory
|
|
vbox.customize ["modifyvm", :id, "--vram", 128]
|
|
# If you want to use the 3D graphic acceleration in the VM, turn it on
|
|
vbox.customize ["modifyvm", :id, "--accelerate3d", "off"]
|
|
# Required. Allows to use more than 16 IRQs, important esp. for 64-bit guests and if more than 1 virtual CPU is used
|
|
vbox.customize ["modifyvm", :id, "--ioapic", "on"]
|
|
# Enable copy & paste between the VM and the host
|
|
vbox.customize ["modifyvm", :id, "--clipboard-mode", "bidirectional"]
|
|
# Disable serial ports (COM) if not needed
|
|
vbox.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
|
|
# If your local network uses the same subnet as the default Virtualbox one (10.0.2.0/24), set a different one here
|
|
vbox.customize ["modifyvm", :id, "--natnet1", "10.0.50.0/24"]
|
|
# Attach a virtual DVD drive to be able to easily install the Virtualbox Guest Additions
|
|
vbox.customize ["storageattach", :id, "--storagectl", "IDE Controller", "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", "emptydrive"]
|
|
#vbox.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
|
|
# Default: The VM is hosted on an SSD.
|
|
# Set to "off" if it is hosted on an HDD to enable performance optimizations for rotational drives (e.g. defragmentation):
|
|
#vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 0, "--nonrotational", "on"]
|
|
#vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 1, "--nonrotational", "on"]
|
|
|
|
# Set to true, if you intent to use a GUI
|
|
vbox.gui = false
|
|
end
|
|
|
|
config.vm.define "satt" do |dev|
|
|
dev.vm.hostname = "satt.local"
|
|
|
|
# If you have installed the Vagrant::Hostsupdate plugin, you can add additional domains
|
|
# that should be mapped to the VM.
|
|
#dev.hostsupdater.aliases = ["nextcloud.satt.local", "jitsi.satt.local"]
|
|
|
|
# An additional IP that allows you to access the VM and its services from the VM host.
|
|
# If you change this IP, you will have to modify the `ansible_host` in the inventory file correspondingly.
|
|
# More information about the various network modes:
|
|
# https://www.virtualbox.org/manual/ch06.html#network_nat_service
|
|
dev.vm.network :private_network, ip: "192.168.23.42"
|
|
|
|
# Provision the VM from the Vagrant host.
|
|
# The host has to have Ansible installed and will connect to the VM via SSH
|
|
# dev.vm.provision :ansible do |ansible|
|
|
# #ansible.verbose = "vvv"
|
|
# ansible.compatibility_mode = "2.0"
|
|
# ansible.playbook = "site.yml"
|
|
# ansible.inventory_path = "inventory.ini.sample"
|
|
# ansible.become = true
|
|
# end
|
|
|
|
# Provision by running Ansible from within the VM.
|
|
# Vagrant will try to install Ansible automatically using pip
|
|
# Advantage: Ansible doesn't have to be installed on the Vagrant host
|
|
# See also: https://www.vagrantup.com/docs/provisioning/ansible_local.html
|
|
dev.vm.provision "ansible_local" do |ansible|
|
|
#ansible.verbose = "vvv"
|
|
ansible.compatibility_mode = "2.0"
|
|
ansible.install_mode = "pip"
|
|
ansible.version = "2.10.3"
|
|
ansible.playbook = "site.yml"
|
|
#ansible.inventory_path = "inventory.ini.sample"
|
|
ansible.galaxy_role_file = "requirements.yml"
|
|
ansible.galaxy_roles_path = "roles"
|
|
ansible.become = true
|
|
end
|
|
end
|
|
|
|
end |