-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Windows is the second popular OS among our users:
It won't be possible to run CVEX straight on Windows, because Ansible doesn't support Windows, however Ansible can run on WSL. I made some research and this is so far I came up with. Dumping my notes:
+Install VirtualBox on Windows:
+https://download.virtualbox.org/virtualbox/7.0.22/VirtualBox-7.0.22-165102-Win.exe
+
+Install WSL on Windows:
+wsl --install
+Reboot Windows and then wait for Ubuntu installation. Open the Ubuntu WSL prompt and then perform the actions below.
+Install Vagrant on Windows:
+https://releases.hashicorp.com/vagrant/2.4.1/vagrant_2.4.1_windows_amd64.msi
+
+Install Vagrant in WSL:
+```
+wget https://releases.hashicorp.com/vagrant/2.4.1/vagrant-2.4.1-1.x86_64.rpm
+sudo apt install alien
+sudo alien -i vagrant-2.4.1-1.x86_64.rpm
+vagrant plugin install virtualbox_WSL2
+echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> ~/.bashrc
+echo 'export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"' >> ~/.bashrc
+source ~/.bashrc
+```
+++ b/src/cvex/consts.py
@@ -1,6 +1,6 @@
from pathlib import Path
-CVEX_ROOT = Path.home() / ".cvex"
+CVEX_ROOT = Path("/mnt/c/Users/John Snow/.cvex")
In linuxvm.py:
@@ -46,11 +47,16 @@ class LinuxVM(VM):
inventory = Path(self.destination, "inventory.ini")
with open(inventory, "w") as f:
self.log.info("Retrieving SSH configuration of %s...", self.vm_name)
+ vagrant_keyfile = self.vag.keyfile()
+ keyfile = f"/tmp/{self.vm_name}.key"
+ self.log.debug("Copying %s to %s", vagrant_keyfile, keyfile)
+ shutil.copyfile(vagrant_keyfile, keyfile)
+ os.chmod(keyfile, 0o600)
data = (f"{self.vm_name} "
f"ansible_host={self.vag.hostname()} "
f"ansible_port={self.vag.port()} "
f"ansible_user={self.vag.user()} "
- f"ansible_ssh_private_key_file={self.vag.keyfile()} "
+ f"ansible_ssh_private_key_file={keyfile} "
f"ansible_ssh_common_args='-o StrictHostKeyChecking=no'")
f.write(data)
return inventory
@@ -63,7 +63,7 @@ class WindowsVM(VM):
data = (f"{self.vm_name} "
f"ansible_connection=winrm "
f"ansible_winrm_scheme=http "
- f"ansible_host={config['host']} "
+ f"ansible_host={self.ip} "
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
