Windows 10: Added a simpler way to provision a VM just by using Vagrant (no WSL required)

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.
This commit is contained in:
Jan Beilicke 2020-11-26 07:56:51 +00:00
parent cc75f43109
commit 6cc72adeab
3 changed files with 49 additions and 15 deletions

View file

@ -47,16 +47,6 @@ The main goals of this project are:
To give SATT a quick spin, you could easily bootstrap a development VM using Vagrant on your local machine. To give SATT a quick spin, you could easily bootstrap a development VM using Vagrant on your local machine.
### Vagrant + Ansible on Windows 10 using Windows Subsystem for Linux
1. [Download](https://www.virtualbox.org/wiki/Downloads) and install Virtualbox ([Documentation](https://www.virtualbox.org/wiki/End-user_documentation))
2. Follow the [guide to install the Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). This SATT guide assumes Ubuntu 18.04 LTS
3. Open Ubuntu through the Windows Start Menu
4. Inside the Ubuntu Terminal, continue the setup by following the next section.
### Vagrant + Ansible on Linux ### Vagrant + Ansible on Linux
1. Obtain Vagrant by [downloading the corresponding package](https://www.vagrantup.com/downloads.html) for your distribution, assuming Ubuntu in the next steps. 1. Obtain Vagrant by [downloading the corresponding package](https://www.vagrantup.com/downloads.html) for your distribution, assuming Ubuntu in the next steps.
@ -111,7 +101,33 @@ By default, a `vagrant` user will be provisioned (if not already available) and
**IMPORTANT**: Pay attention to the [Firewall](#firewall) section below. **IMPORTANT**: Pay attention to the [Firewall](#firewall) section below.
## Quickstart: Regular server/VM ### Vagrant on Windows 10 (no Ansible required)
Vagrant will bootstrap a VM, install Ansible und run the provisioning from within the VM, i.e. the Vagrant host does not need to have any Ansible installed.
1. [Download](https://www.virtualbox.org/wiki/Downloads) and install Virtualbox ([Documentation](https://www.virtualbox.org/wiki/End-user_documentation))
2. Obtain Vagrant by [downloading and installing the corresponding package](https://www.vagrantup.com/downloads.html)
3. Clone this repository with Git or download and extract an archive
4. Open a Command Prompt or Powershell window and navigate to the checked out repository / extracted archive.
5. Run Vagrant with: `vagrant up` and wait patiently.
### Vagrant on Windows 10 using Windows Subsystem for Linux + Ansible
This approach will install Vagrant and Ansible in a Linux box using WSL. Vagrant will provision the VM with Ansible from the Vagrant host over SSH.
1. [Download](https://www.virtualbox.org/wiki/Downloads) and install Virtualbox ([Documentation](https://www.virtualbox.org/wiki/End-user_documentation))
2. Follow the [guide to install the Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). This SATT guide assumes Ubuntu 18.04 LTS
3. Open Ubuntu through the Windows Start Menu
4. Inside the Ubuntu Terminal, continue the setup by following the next section.
## Quickstart: Regular Linux server/VM
- Clone this repo - Clone this repo
- Install dependencies (roles): `ansible-galaxy install -r requirements.yml` - Install dependencies (roles): `ansible-galaxy install -r requirements.yml`

24
Vagrantfile vendored
View file

@ -54,11 +54,29 @@ Vagrant.configure(2) do |config|
# https://www.virtualbox.org/manual/ch06.html#network_nat_service # https://www.virtualbox.org/manual/ch06.html#network_nat_service
dev.vm.network :private_network, ip: "192.168.23.42" dev.vm.network :private_network, ip: "192.168.23.42"
dev.vm.provision :ansible do |ansible| # 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.verbose = "vvv"
ansible.compatibility_mode = "2.0" ansible.compatibility_mode = "2.0"
ansible.playbook = "./site.yml" ansible.install_mode = "pip"
ansible.inventory_path = "./inventory.ini.sample" 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 ansible.become = true
end end
end end

View file

@ -1,5 +1,5 @@
# All hosts # All hosts
satt ansible_user=vagrant ansible_host=192.168.23.42 satt ansible_user=vagrant
[vagrant] [vagrant]
satt satt