shellpki/Vagrantfile

40 lines
1.2 KiB
Ruby
Raw Permalink Normal View History

2018-04-11 14:32:45 +02:00
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Load ~/.VagrantFile if exist, permit local config provider
vagrantfile = File.join("#{Dir.home}", '.VagrantFile')
load File.expand_path(vagrantfile) if File.exists?(vagrantfile)
Vagrant.configure('2') do |config|
config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__exclude: [ '.vagrant', '.git' ]
2019-01-16 16:21:35 +01:00
config.ssh.shell="/bin/sh"
2018-04-11 14:32:45 +02:00
$deps = <<SCRIPT
mkdir -p /etc/shellpki
2019-01-21 14:34:36 +01:00
if [ "$(uname)" = "Linux" ]; then
id shellpki 2>&1 >/dev/null || useradd shellpki --system -M --home-dir /etc/shellpki --shell /usr/sbin/nologin
fi
if [ "$(uname)" = "OpenBSD" ]; then
id _shellpki 2>&1 >/dev/null || useradd -r 1..1000 -d /etc/shellpki -s /sbin/nologin _shellpki
fi
2018-04-11 14:32:45 +02:00
ln -sf /vagrant/openssl.cnf /etc/shellpki/
ln -sf /vagrant/shellpki /usr/local/sbin/shellpki
2018-04-11 14:32:45 +02:00
SCRIPT
2019-01-21 14:34:36 +01:00
nodes = [
{ :name => "debian", :box => "debian/stretch64" },
{ :name => "openbsd", :box => "generic/openbsd6" }
]
2018-04-11 14:32:45 +02:00
2019-01-21 14:34:36 +01:00
nodes.each do |i|
config.vm.define "#{i[:name]}" do |node|
node.vm.hostname = "shellpki-#{i[:name]}"
node.vm.box = "#{i[:box]}"
config.vm.provision "deps", type: "shell", :inline => $deps
end
2018-04-11 14:32:45 +02:00
end
2019-01-21 14:34:36 +01:00
2018-04-11 14:32:45 +02:00
end