Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (83 sloc) 3.33 KB
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "fedora/27-cloud-base"
config.vm.provision "shell" do |shell|
shell.privileged = true
shell.inline = <<-SHELL
sed -i \
-e 's/PermitRootLogin/#PermitRootLogin/g' \
-e 's/#MaxAuthTries 6/MaxAuthTries 3/g' \
-e 's/PasswordAuthentication yes/PasswordAuthentication no/g' \
/etc/ssh/sshd_config
systemctl restart sshd
SHELL
end
config.vm.network "private_network", type: "dhcp"
config.vm.define "ceres" do |ceres|
ceres.vm.hostname = "ceres"
ceres.vm.provision "shell" do |shell|
shell.privileged = true
shell.inline = <<-SHELL
useradd -G wheel miller
echo belter | passwd miller --stdin
mkdir -p /home/miller/.ssh
chmod 'u=rwx,go=' /home/miller/.ssh
cp /vagrant/keys/miller /home/miller/.ssh/id_rsa
cp /vagrant/keys/miller.pub /home/miller/.ssh/id_rsa.pub
chown -R miller:miller /home/miller/.ssh
useradd service
echo some_pass | passwd service --stdin
mkdir -p /home/service/.ssh
chmod 'u=rwx,go=' /home/service/.ssh
cp /vagrant/keys/holden.pub /home/service/.ssh/authorized_keys
chmod 'u=rw,go=' /home/service/.ssh/authorized_keys
chown -R service:service /home/service/.ssh
SHELL
end
end
config.vm.define "earth" do |earth|
earth.vm.hostname = "earth"
earth.vm.provision "shell" do |shell|
shell.privileged = true
shell.inline = <<-SHELL
useradd -G wheel holden
echo hauler | passwd holden --stdin
mkdir -p /home/holden/.ssh
chmod 'u=rwx,go=' /home/holden/.ssh
cp /vagrant/keys/holden /home/holden/.ssh/id_rsa
cp /vagrant/keys/holden.pub /home/holden/.ssh/id_rsa.pub
chown -R holden:holden /home/holden/.ssh
useradd service
echo some_pass | passwd service --stdin
mkdir -p /home/service/.ssh
chmod 'u=rwx,go=' /home/service/.ssh
cp /vagrant/keys/miller.pub /home/service/.ssh/authorized_keys
chmod 'u=rw,go=' /home/service/.ssh/authorized_keys
chown -R service:service /home/service/.ssh
SHELL
end
end
config.vm.define "mars" do |mars|
mars.vm.hostname = "mars"
mars.vm.provision "shell" do |shell|
shell.privileged = true
shell.inline = <<-SHELL
useradd miller
echo belter | passwd miller --stdin
mkdir -p /home/miller/.ssh
chmod 'u=rwx,go=' /home/miller/.ssh
cp /vagrant/keys/miller.pub /home/miller/.ssh/authorized_keys
chmod 'u=rw,go=' /home/miller/.ssh/authorized_keys
chown -R miller:miller /home/miller/.ssh
useradd holden
echo hauler | passwd holden --stdin
mkdir -p /home/holden/.ssh
chmod 'u=rwx,go=' /home/holden/.ssh
cp /vagrant/keys/holden.pub /home/holden/.ssh/authorized_keys
chmod 'u=rw,go=' /home/holden/.ssh/authorized_keys
chown -R holden:holden /home/holden/.ssh
SHELL
end
end
end