initial commit

This commit is contained in:
paramah 2022-11-11 14:07:35 +01:00
commit 7aef0a55e3
3 changed files with 81 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.vagrant/
tmp/

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
.PHONY: help
.DEFAULT_GOAL := help
# Uppercase vars for internal use.
UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')
LOG_ERROR = @printf "\n>> \e[0;31m$1\e[0;00m\n\n"
LOG_WARN = @printf "\n>> \e[0;33m$1\e[0;00m\n\n"
LOG_INFO = @printf "\n>> \e[0;34m$1\e[0;00m\n\n"
LOG_SUCCESS = @printf "\n>> \e[0;36m$1\e[0;00m\n\n"
LOG_SUBLINE = @printf " \e[0;34m$1\e[0;00m\n\n"
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
up: ## Vagrant: start stack
$(call LOG_INFO,Up vagrant stack)
vagrant up --no-destroy-on-error --no-tty --provider=libvirt
stop: ## Vagrant: stop stack
$(call LOG_INFO,Stop vagrant stack)
vagrant halt --force
destroy: ## Vagrant: destroy stack
$(call LOG_INFO,Destroy vagrant stack)
vagrant destroy --force
ps: ## Vagrant: list machines
$(call LOG_INFO,List vagrant stack)
vagrant status
server: ## Vagrant: connect to server1
$(call LOG_INFO,Connect to server1 via ssh)
vagrant ssh server1

44
Vagrantfile vendored Normal file
View File

@ -0,0 +1,44 @@
# to make sure the nodes are created in order, we
# have to force a --no-parallel execution.
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
require 'ipaddr'
number_of_server_nodes = 5
domain = "dexter.lab"
Vagrant.configure(2) do |config|
config.vm.box = 'debian/bullseye64'
config.vm.provider 'libvirt' do |lv, config|
lv.cpus = 2
lv.cpu_mode = 'host-passthrough'
lv.nested = true
lv.keymap = 'pt'
config.vm.synced_folder '.', '/vagrant', type: 'nfs', nfs_version: '4.2', nfs_udp: false
end
(1..number_of_server_nodes).each do |n|
name = "tt-testing#{n}"
fqdn = "#{name}.#{domain}"
config.vm.define name do |config|
config.vm.provider 'libvirt' do |lv, config|
lv.memory = 2*1024
end
config.vm.hostname = fqdn
config.vm.network :public_network,
:dev => "virbr1",
:bridge => "virbr1",
:mode => "bridge",
:type => "bridge"
config.vm.provision "shell" do |s|
ssh_pub_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGdjG96nkwWE9k7V8YJcog5jnlclWm8aq6QWhChmVoCvvD84W4cm6CuLvLt/cc0kcvyL7nfph0EbtSeH/n6ze1ZoJ38DFLn1iqZfc/oCIwYPA7mO5hd+On8Lgwu5sILerRHjh+YaXH6RWOJyJxbprqIjX7TVLSUm3eBpNSsnotA806bI5rqLmrvXMKM7Uwck+QvHb7PK80ehdysrG8Hi1Z6XC7nhTFV0jHHfUyH5/zdhG2ABkTYb+GMGeAHiEFk9UF5gVB61MFZYsz/MR/v6chemkOtDVFGrOvLGwKsvG/z9fBrgcA7E+H6brZnU9IuNhpQUI9b9YJzNPq7ok2x9odX9TU7uhwYnTlVlJPlZUaUMEAPb/74kWurVrmiAQaXxhgqmPQ6Hnae6OA2H5rPCpacHupSC3En2r01MI875/vCZhXKCyXX570Z1iqqbH+M+vmN2uenFL0eZqe/iXuF1Kl7SKS88cngIqnOIPFMz26boRqcP+NOjisTXb4+qnofBc= paramah@rork"
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
SHELL
end
end
end
end