| Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia |
| tech:vagrant:start [12/09/2018 02:34] – [resumen comandos] mate | tech:vagrant:start [14/02/2022 09:48] (actual) – mate |
|---|
| = vagrant | = VAGRANT |
| {{tag>devops info}} | {{tag>devops info}} |
| ~~NOTOC~~ | ~~NOTOC~~ |
| | * [[tech:vagrant:vagrantfile]] |
| | * [[tech:vagrant:vagrantfile-examples]] |
| |
| == related | == related |
| {{topic>vagrant}} | {{topic>vagrant&nouser&nodate&tags}} |
| [[tech:vagrant:casosuso]] | |
| |
| | == help |
| | * [[https://www.vagrantup.com/docs/vagrantfile/machine_settings]] |
| | * vagrant_hosts -> ''sync_hosts'': [[https://www.rubydoc.info/gems/vagrant-hosts/2.6.2]] |
| == config files | == config files |
| * config.vm : [[https://www.vagrantup.com/docs/vagrantfile/machine_settings.html]] | * config.vm : [[https://www.vagrantup.com/docs/vagrantfile/machine_settings.html]] |
| | * provision docker : [[https://www.vagrantup.com/docs/provisioning/docker.html]] |
| |
| == resumen comandos | == resumen comandos |
| === imágenes (box) | === imágenes (box) |
| * ''vagrant box add <imagen>'': descargar | * ''vagrant box add <imagen>'': descargar |
| | * alternativamente, descarga manual: ''wget https://app.vagrantup.com/<USER>/boxes/<BOX>/versions/<VERSION>/providers/<PROVEEDOR>.box'' |
| * ''vagrant box list'': listar imagenes disponibles | * ''vagrant box list'': listar imagenes disponibles |
| * ''vagrant box repackage <imagen> <proveedor> <version>'': generar fichero .box a partir de imagen descargada | * ''vagrant box repackage <imagen> <proveedor> <version>'': generar fichero .box a partir de imagen descargada |
| === Vagrantfile | === Vagrantfile |
| * ''vagrant validate'' : comprueba que el fichero **Vagrantfile** sea correcto | * ''vagrant validate'' : comprueba que el fichero **Vagrantfile** sea correcto |
| * ''config.vm.network "private_network", ip: "192.168.50.4"'': [[https://www.vagrantup.com/docs/networking/private_network.html]] | |
| |
| |
| === otros | === otros |
| * ''vagrant validate'': comprueba la validez sintáctica de un **Vagrantfile** | * ''vagrant rsync'': sincroniza los directorios "compartidos" entre el host y la VM |
| | * ''vagrant rsync-auto'' : demonio que se encarga de mantener los directorios "compartidos" en syncro contínua |
| |
| == plugins | == plugins |
| | === vagrant-hosts |
| | * ''vagrant plugin install vagrant-hosts'' -> [[https://www.rubydoc.info/gems/vagrant-hosts/2.6.2]] |
| | * <code ruby> |
| | Vagrant.configure('2') do |config| |
| | config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" |
| | |
| | config.vm.provision :hosts do |provisioner| |
| | # Add a single hostname |
| | provisioner.add_host '10.0.2.2', ['myhost.vagrantup.internal'] |
| | |
| | # Or a fqdn and a short hostname |
| | provisioner.add_host '10.0.2.3', ['myotherhost.vagrantup.internal', 'myotherhost'] |
| | |
| | # Or as many aliases as you like! |
| | provisioner.add_host '10.0.2.5', [ |
| | 'mypuppetmaster.vagrantup.internal', |
| | 'puppet.vagrantup.internal', |
| | 'mypuppetmaster', |
| | 'puppet' |
| | ] |
| | end |
| | end |
| | </code> |
| === disk-size | === disk-size |
| * ''vagrant plugin install vagrant-disksize'' : ayuda a crear discos "a medida"<sxh ruby; title: uso plugin>Vagrant.configure("2") do |config| | * ''vagrant plugin install vagrant-disksize'' : ayuda a crear discos "a medida"<sxh ruby; title: uso plugin>Vagrant.configure("2") do |config| |