-
-
Save seb-schulz/c26d70818f90af5ae868779c86403652 to your computer and use it in GitHub Desktop.
Simple vagrant provider for devpod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: vagrant | |
version: v0.1.0 | |
exec: | |
init: |- | |
which vagrant > /dev/null || exit 1 | |
command: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
vagrant ssh -c "${COMMAND}" | |
create: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
vagrant up | |
delete: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
vagrant destroy -f | |
start: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
vagrant up | |
stop: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
vagrant halt -f | |
status: |- | |
cd ${MACHINE_FOLDER} | |
test ! -f Vagrantfile && cp ${VAGRANTFILE} . | |
case "$(vagrant status --machine-readable | grep ',state,' | cut -d, -f4)" in | |
running) echo "running" ;; | |
poweroff) echo "stopped" ;; | |
*) echo "notfound" ;; | |
esac | |
options: | |
VAGRANTFILE: | |
description: "Vagrantfile which should be used" | |
required: yes | |
global: yes | |
command: "echo $(pwd)/Vagrantfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ed25519.pub").first.strip | |
config.vm.box = "debian/testing64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = 4*1024 | |
vb.cpus = 4 | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
apt-get update | |
apt-get install -y htop git docker.io docker-compose | |
grep '#{ssh_pub_key}' .ssh/authorized_keys > /dev/null && true || echo '#{ssh_pub_key}' >> .ssh/authorized_keys | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment