Remove SSH keys and generate them instead

This commit is contained in:
Aleksandr Didenko 2016-06-16 12:29:08 +02:00
parent 62e98bd4b0
commit cdfbcc1046
5 changed files with 15 additions and 29 deletions

10
Vagrantfile vendored
View file

@ -15,11 +15,16 @@ $private_subnet = prefix.to_s + ".1"
$mgmt_cidr = prefix.to_s + ".2.0/24" $mgmt_cidr = prefix.to_s + ".2.0/24"
$instance_name_prefix = "#{$user}-k8s" $instance_name_prefix = "#{$user}-k8s"
# Boxes with libvirt provider support: # Boxes with libvirt provider support:
#$box = "yk0/ubuntu-xenial" #900M #$box = "yk0/ubuntu-xenial" #900M
#$box = "centos/7" #$box = "centos/7"
$box = "nrclark/xenial64-minimal-libvirt" $box = "nrclark/xenial64-minimal-libvirt"
# Create SSH keys for future lab
system 'bash ssh-keygen.sh'
# Create nodes list for future kargo deployment
nodes="" nodes=""
(1..$num_instances).each do |i| (1..$num_instances).each do |i|
ip = "#{$private_subnet}.#{i+10}" ip = "#{$private_subnet}.#{i+10}"
@ -27,6 +32,7 @@ nodes=""
end end
File.open("nodes", 'w') { |file| file.write(nodes) } File.open("nodes", 'w') { |file| file.write(nodes) }
# Create the lab
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
(1..$num_instances).each do |i| (1..$num_instances).each do |i|
# First node would be master node # First node would be master node
@ -37,11 +43,15 @@ Vagrant.configure("2") do |config|
bootstrap_script = "bootstrap-node.sh" bootstrap_script = "bootstrap-node.sh"
master = false master = false
end end
config.ssh.insert_key = false config.ssh.insert_key = false
vm_name = "%s-%02d" % [$instance_name_prefix, i] vm_name = "%s-%02d" % [$instance_name_prefix, i]
config.vm.define vm_name do |test_vm| config.vm.define vm_name do |test_vm|
test_vm.vm.box = $box test_vm.vm.box = $box
test_vm.vm.hostname = vm_name test_vm.vm.hostname = vm_name
# Libvirt provider settings
test_vm.vm.provider :libvirt do |domain| test_vm.vm.provider :libvirt do |domain|
domain.uri = "qemu+unix:///system" domain.uri = "qemu+unix:///system"
domain.memory = $vm_memory domain.memory = $vm_memory

5
ssh-keygen.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
mkdir -p ssh
if ! [ -f ssh/id_rsa ] ; then
ssh-keygen -N '' -t rsa -f ssh/id_rsa && cp ssh/id_rsa.pub ssh/authorized_keys
fi

View file

@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMw+fFXL37UxmicLHQfH+bW8ok/cw+Qd0mWw7NifIw21HtpvMMhE2zzWdJxewjmFG9xZ78F1xYYoJTamnggtpAi8vn+yP2tAlqC9PrW02vNgK3AkhFF2EtdL8anWl4m5YMGeGbN8ykVZeznbflsBiJ0MOgI0RUvukQf6K6I9zKof/tEzntKJO/aL54wC93e2ej2JOE3tMt1ABocOAGv2hJM1nYu2hUcoR9fmSLDhOTpRQY5SLqozZ52GYbx+T180GW6FaKUjcC0DTFFQE8K+98n4oL2mbWpHjDM1u2d3wcrBryDqXjBHat7bv+QW1DisauQzvxwMkwFVa1Jb08XEdX

View file

@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAzMPnxVy9+1MZonCx0Hx/m1vKJP3MPkHdJlsOzYnyMNtR7abz
DIRNs81nScXsI5hRvcWe/BdcWGKCU2pp4ILaQIvL5/sj9rQJagvT61tNrzYCtwJI
RRdhLXS/Gp1peJuWDBnhmzfMpFWXs5235bAYidDDoCNEVL7pEH+iuiPcyqH/7RM5
7SiTv2i+eMAvd3tno9iThN7TLdQAaHDgBr9oSTNZ2LtoVHKEfX5kiw4Tk6UUGOUi
6qM2edhmG8fk9fNBluhWilI3AtA0xRUBPCvvfJ+KC9pm1qR4wzNbtnd8HKwa8g6l
4wR2re27/kFtQ4rGrkM78cDJMBVWtSW9PFxHVwIDAQABAoIBADFEEUeTAMKvQ8Op
iZ631ZvzgbdUuQdhoWvRDMa3IeZPXm7ndCLW0jsoeGlvjVkjFMer/Ix6smUxjlmz
iLXTxd8xw2WVLxn0Ry+UmPBPj2lQ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