Przejdź do treści
Biblioteka skilli
DevOps i chmura · Automatyzacja

vagrant

/vagrant

Wspiera pracę z HashiCorp Vagrant: konfiguracja Vagrantfile, dostawcy wirtualizacji (VirtualBox, Libvirt) i provisionery (Shell, Ansible), przy automatyzacji odtwarzalnych lokalnych maszyn wirtualnych.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wspiera pracę z HashiCorp Vagrant: konfiguracja Vagrantfile, dostawcy wirtualizacji (VirtualBox, Libvirt) i provisionery (Shell, Ansible), przy automatyzacji odtwarzalnych lokalnych maszyn wirtualnych.

Oryginalny opis (EN)

Expert HashiCorp Vagrant assistance covering Vagrantfile configuration, virtualization providers (VirtualBox, Libvirt), and provisioners (Shell, Ansible). Use when automating reproducible local virtual machines.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 154 linii, 548 słów
Podgląd SKILL.md
---
name: vagrant
description: Expert HashiCorp Vagrant assistance covering Vagrantfile configuration, virtualization providers (VirtualBox, Libvirt), and provisioners (Shell, Ansible). Use when automating reproducible local virtual machines.
---

# Vagrant

Vagrant provides reproducible, portable development environments using Virtual Machines (VirtualBox, VMWare, Hyper-V).

## When to Use

- **Local Multi-VM Development Environments**: Creating isolated virtual machines using VirtualBox, VMware, or Libvirt.
- **Testing Infrastructure Playbooks**: Validating Ansible, Chef, and shell provisioning scripts before cloud deployment.
- **Legacy System Emulation**: Simulating specific enterprise Linux OS distributions and kernel versions locally.
- **Cross-Platform Team Alignment**: Providing identical developer VM environments across macOS, Windows, and Linux.

## Quick Start

```ruby
# Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/bionic64"
  config.vm.network "forwarded_port", guest: 80, host: 8080

  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get install -y apache2
  SHELL
end
```

`vagrant up` -> `vagrant ssh`

## Core Concepts

### Multi-Machine Vagrantfile with Ansible Provisioning

Declaring clustered VM topologies:

```ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # Base box image
  config.vm.box = "bento/ubuntu-24.04"

  # Master Node
  config.vm.define "control-plane" do |master|
    master.vm.hostname = "control-plane.local"
    master.vm.network "private_network", ip: "192.168.56.10"

    master.vm.provider "virtualbox" do |vb|
      vb.memory = "4096"
      vb.cpus = 2
    end

    master.vm.provision "ansible" do |ansible|
      ansible.playbook = "playbooks/setup_k8s_master.yml"
    end
  end

  # Worker Node
  config.vm.define "worker-01" do |worker|
    worker.vm.hostname = "worker-01.local"
    worker.vm.network "private_network", ip: "192.168.56.11"

    worker.vm.provider "virtualbox" do |vb|
      vb.memory = "2048"
      vb.cpus = 2
    end
  end

  # Shared folder mapping
  config.vm.synced_folder "./shared", "/mnt/shared", type: "nfs"
end
```

### Essential Vagrant CLI Commands

Managing VM lifecycle:

```bash
# Launch and provision all machines
vagrant up

# SSH into specific defined machine
vagrant ssh control-plane

# Re-run provisioners on active VM
vagrant provision

# Suspend or destroy environment
vagrant suspend
vagrant destroy -f
```

## Common Patterns

### Multi-Machine Cluster with Private Network and Shell Provisioning

**Problem**: Simulating a multi-node cluster locally with hardcoded IPs and dependencies.

**Solution**:
Define multi-machine topology in `Vagrantfile`:

```ruby
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/noble64"

  # Master Node
  config.vm.define "master" do |master|
    master.vm.network "private_network", ip: "192.168.56.10"
    master.vm.provider "virtualbox" do |vb|
      vb.memory = "2048"
      vb.cpus = 2
    end
  end

  # Worker Node
  config.vm.define "worker" do |worker|
    worker.vm.network "private_network", ip: "192.168.56.11"
    worker.vm.provider "virtualbox" do |vb|
      vb.memory = "1024"
    end
  end

  config.vm.provision "shell", inline: "apt-get update && apt-get install -y curl"
end
```

## Best Practices

**Do**:

- Use official, verified boxes (e.g. `bento/*` or `generic/*`) to ensure clean base operating system states.
- Commit `Vagrantfile` to source control while adding `.vagrant/` to `.gitignore`.
- Use NFS or VirtioFS for synced folders to improve file system I/O performance on macOS and Linux.
- Test provisioning idempotency with `vagrant provision`.

**Don't**:

- Allocate more RAM than available on the host machine; check host resources before launching multi-VM setups.
- Store credentials or SSH private keys inside synced shared folders.
- Use Vagrant for production deployments; it is strictly intended for local development and testing.

## Troubleshooting

| Error                                             | Cause                                                                  | Solution                                                          |
| :------------------------------------------------ | :--------------------------------------------------------------------- | :---------------------------------------------------------------- |
| `Timed out while waiting for the machine to boot` | VirtualBox hardware virtualization (VT-x/AMD-V) disabled in BIOS.      | Enable hardware virtualization in host BIOS settings.             |
| `Failed to mount VirtualBox shared folders`       | Guest Additions version mismatch or not installed inside VM.           | Install vagrant plugin: `vagrant plugin install vagrant-vbguest`. |
| `SSH authentication failed for 'vagrant'`         | Corrupted insecure private key in `~/.vagrant.d/insecure_private_key`. | Delete `.vagrant/` directory and recreate with `vagrant up`.      |

## References

- [Vagrant Documentation](https://developer.hashicorp.com/vagrant)

Wersje

W bazie nie ma innych skilli o nazwie vagrant.

Migawka bazy z 13.11.2026 · wersja paczki 575c43cc3bae (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100packer
    Wspiera pracę z HashiCorp Packer: szablony HCL2, buildery (AWS AMI, GCP, Azure, Docker) i provisionery przy automatyzacji tworzenia niezmiennych obrazów maszyn.
  • 100ansible
    Pomaga w automatyzacji z Ansible: playbooki, role, inwentarz, idempotentne moduły i Ansible Vault przy konfiguracji serwerów i wdrożeniach aplikacji.
  • 90vm-network-setup
    Konfiguruje wirtualne sieci libvirt: tworzy, uruchamia i zatrzymuje sieci, wyszukuje aktywne hosty i diagnozuje łączność maszyn.
  • 95shell-to-ansible
    Zamienia skrypty powłoki na idempotentne playbooki Ansible według dobrych praktyk Red Hat i wzorców deklaratywnych.
  • 100linux-virtualization
    Obsługuje maszyny wirtualne KVM/libvirt i kontenery systemowe LXD: cykl życia, migawki, kopie, storage, sieć oraz inspekcję hosta.
  • 100creating-ansible-playbooks
    Tworzy playbooki Ansible do automatyzacji konfiguracji, na prośbę o utworzenie playbooka lub automatyzację przez Ansible.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.