{
  "markdown": "# Dev Setups\n\nThis repository provides a streamlined approach to setting up development environments using **Vagrant** for provisioning and **Ansible** for configuration and tooling. It is tailored to support relevant Git repositories and ensure a consistent development setup.\n\n## Features\n- Automated provisioning with Vagrant.\n- QEMU/KVM + libvirt as the supported local virtualization stack.\n- Configuration management and tooling setup using Ansible.\n- Pre-configured roles for dependencies, development tools, Docker, GitHub CLI, VS Code, and more.\n\n## Quick Start\nTo set up the basic tooling environment, run the following command:\n\n\n```bash\nwget --header=\"Cache-Control: no-cache\" -qO- \"https://raw.githubusercontent.com/arslan-qamar/devsetups/refs/heads/main/bootstrap.sh?ts=$(date +%s)\" | bash -s \"main.yml\" \"localhost,\" \"local\" \"install\" \"deps,devbox,docker,githubcli,vscode\"\n```\n\n## Running Ansible Playbook Against a VM\nTo run the Ansible playbook directly against a VM (for example, to configure MicroK8s on a remote host), use:\n\n```bash\nansible-playbook -i '<vm-name.local | 192.168.0.*>,' -u ubuntu --ssh-common-args=\"-F $VAGRANT_SSH_CFG \" $MAIN_ANSIBLE  --extra-vars \"state=present target_hosts=<vm-name.local | 192.168.0.*>\" -t=\"microk8s\" -K\n```\n\nReplace `<vm-name.local | 192.168.0.*>` with your VM's Name or VM's IP address. This command uses the specified SSH config and runs the playbook with the `microk8s` tag. The `-K` flag will prompt for the sudo password if needed.\n\n## Enable 3D Graphics After Provisioning\nTo enable the custom libvirt 3D graphics layout on a VM after it has already been created and provisioned, run:\n\n```bash\n./toolbox/libvirt/enable_3d_graphics.sh <domain|vm-name|vm-directory>\n```\n\nExamples:\n\n```bash\n./toolbox/libvirt/enable_3d_graphics.sh gaspeep\n./toolbox/libvirt/enable_3d_graphics.sh gaspeep_vm\n./toolbox/libvirt/enable_3d_graphics.sh \"dev vms/gaspeep\"\n```\n\nThe command patches the libvirt domain XML to use the separate SPICE socket, `egl-headless`, and virtio video configuration, then restarts or starts the VM so the change takes effect.\n\nIf a host cannot initialize EGL and a patched VM fails to start with `eglInitialize failed: EGL_NOT_INITIALIZED`, restore the standard SPICE-only graphics layout with:\n\n```bash\n./toolbox/libvirt/disable_3d_graphics.sh <domain|vm-name|vm-directory>\n```\n\n## Libvirt Network After Host Reboot\nIf a VM created with `vagrant-libvirt` fails to start after a host reboot with `network 'vagrant-libvirt' is not active`, enable and start that network once on the host:\n\n```bash\nvirsh -c qemu:///system net-autostart vagrant-libvirt\nvirsh -c qemu:///system net-start vagrant-libvirt\n```\n\nThe shared Vagrant base file now also re-starts that network before `vagrant up` and marks it for autostart after the network exists, so future reboots do not require the manual step.\n\nFor bridged guest networking, the shared Vagrant base now prefers an active host bridge such as `br0`. If no host bridge exists, it falls back to the host's active uplink interface and attaches the guest in libvirt direct bridge mode instead of silently creating a private-only NIC. You can override the selected interface with `VAGRANT_BRIDGE=<interface>` before running `vagrant up`.\n\n## Configure Host GPU Passthrough\nTo re-apply the host-side VFIO and GRUB changes needed for NVIDIA GPU passthrough after a host reinstall, run:\n\n```bash\nsudo ./toolbox/libvirt/configure_gpu_passthrough_host.sh\n```\n\nBy default the script targets the current RTX 3060 Ti GPU function IDs that were inspected on this host:\n\n```bash\n10de:2486,10de:228b\n```\n\nTo target a different GPU after hardware changes, override the PCI IDs:\n\n```bash\nsudo ./toolbox/libvirt/configure_gpu_passthrough_host.sh --vfio-pci-ids 10de:1b80,10de:10f0\n```\n\nThe script updates `/etc/default/grub`, writes `/etc/modprobe.d/vfio.conf`, ensures VFIO modules load early, rebuilds initramfs, and runs `update-grub`. Reboot the host afterwards, then verify the GPU functions are bound to `vfio-pci` before creating or starting a passthrough VM.\n\n## Repository Structure\n- **bootstrap.sh**: Entry point script for setting up the environment.\n- **roles/**: Contains Ansible roles for various tools and configurations.\n  - **deps/**: Handles dependencies.\n  - **nodejs/**: Installs Node.js from NodeSource.\n  - **devbox/**: Sets up the development box.\n  - **docker/**: Configures Docker.\n  - **githubcli/**: Installs and configures GitHub CLI.\n  - **vscode/**: Sets up Visual Studio Code.\n  - **mongodb_compass/**: Installs MongoDB Compass.\n  - **zsh/**: Configures Zsh shell.\n- **ubuntu-autoinstall/**: Contains files for Ubuntu auto-installation and Vagrant base setup.\n\nTo install Node.js on its own, run the playbook with the `nodejs` tag.\n\n## How It Works\n1. **Provisioning**: Vagrant is used to create and manage virtual machines.\n2. **Configuration**: Ansible applies configurations and installs necessary tools.\n\nFor a comprehensive understanding of how all components work together, see the [Codebase Tutorial](codebase%20tutorial/index.md).\n\n## Contributing\nContributions are welcome! Please fork the repository and submit a pull request for any improvements or additional features.\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n\n",
  "bytes": 5315,
  "sha": "41ae6c6b742463458c3a9c34a77ce1a24c8d13144beab1e7cb262b03be7ea7b4",
  "repo_slug": "arslan-qamar/devsetups",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_arslan_qamar_devsetups_openwiki_index_md_f94306e9/readme"
}