Vagrant: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
Zeile 17: Zeile 17:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo vagrant up
sudo vagrant up
vagrant ssh ansible
vagrant global-status
vagrant box { list | update }
vagrant { up | halt reload | destroy } [<name>]
vagrant snapshot list
vagrant snapshot { push | pop } [<name>]
</syntaxhighlight>
</syntaxhighlight>



Version vom 30. Oktober 2022, 18:11 Uhr

Links

Beispiel

  • Vagrantfile
  • HostOnly-Netzwerk 192.168.150.0/24 ist eingerichtet
NETWORK_PREFIX = "192.168.150"
Vagrant.configure("2") do |config|
  config.vm.define "ansible" do |ansible|
    ansible.vm.box = "bento/debian-11"
    ansible.vm.hostname = "ansible"
    ansible.vm.network :private_network, ip: "#{NETWORK_PREFIX}.100"
  end
end
sudo vagrant up
vagrant ssh ansible
vagrant global-status
vagrant box { list | update }
vagrant { up | halt reload | destroy } [<name>]
vagrant snapshot list
vagrant snapshot { push | pop } [<name>]

Installation

  • Virtualbox muss installiert sein, 6.1 ist OK, 7.0 (noch) nicht
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
apt update && sudo apt install vagrant
echo "* 0.0.0.0/0 ::/0" >/etc/vbox/networks.conf