Install
https://www.vagrantup.com/downloads.html
# sudo apt install -y jq
URL=$(wget https://checkpoint-api.hashicorp.com/v1/check/vagrant -qO- | jq -r '"https://releases.hashicorp.com/vagrant/" + .current_version + "/vagrant_" + .current_version + "_x86_64.deb"')
wget ${URL} -qP /tmp
sudo dpkg -i /tmp/${URL##*/}
vagrant --versionInstall with Ansible
- name: Get latest vagrant version
uri:
url: https://checkpoint-api.hashicorp.com/v1/check/vagrant
register: release
- set_fact:
version: "{{ release.json | json_query('current_version') }}"
- name: Install Vagrant
apt:
deb: https://releases.hashicorp.com/vagrant/{{ version }}/vagrant_{{ version }}_x86_64.deb
become: yes
- name: Adding user ubuntu to group libvirt
user:
name: ubuntu
groups: libvirt
append: yes
become: yes
- name: Install vagrant-libvirt plugin
command: sudo -H -u ubuntu vagrant plugin install vagrant-libvirt
become: yesCLI
# deploy / start VM
vagrant up
# list VMs
vagrant show
# show VM IPs
vagrant ssh-config
# ssh to VM
vagrant ssh vm1
# stop VM
vagrant halt vm1
# delete ALL VMs
vagrant destroy -f
Images
https://app.vagrantup.com/boxes/search
Vagrant LXD
https://gitlab.com/catalyst-it/devtools/vagrant-lxd
Links
https://www.vagrantup.com/
https://checkpoint-api.hashicorp.com/v1/check/vagrant