Add extra variant

This commit is contained in:
Glenn Y. Rolland 2024-07-16 13:37:55 +02:00
parent af6a10b9d8
commit 4bd6979e38
8 changed files with 273 additions and 0 deletions

32
vm-1.vm-1.devstack/Vagrantfile vendored Normal file
View file

@ -0,0 +1,32 @@
# vim: set ts=2 sw=2 et ft=ruby:
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bookworm64'
config.vm.provider 'libvirt' do |domain|
domain.memory = 16_000
domain.nested = true
domain.cpu_mode = 'host-model'
# domain.cpus = 2
end
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.memory = 16_000.to_s
# vb.nested = true
vb.customize ['modifyvm', :id, '--nested-hw-virt', 'on']
end
# config.vm.synced_folder '..', '/vagrant' #, type: 'nfs', mount_options: ['actimeo=2']
# config.vm.synced_folder '../../exercises', '/vagrant/exercises' #, type: 'nfs', mount_options: ['actimeo=2']
# config.vm.synced_folder '../../config', '/vagrant/config' #, type: 'nfs', mount_options: ['actimeo=2']
config.vm.define 'host' do |machine|
machine.vm.hostname = 'host'
end
config.vm.provision 'shell', name: 'provision/host', path: 'provision/host.sh', privileged: true
# config.vm.provision 'shell', name: 'provision/inception', path: 'provision/inception.sh', privileged: false
config.vm.provision 'shell', inline: 'echo SUCCESS'
end

View file

@ -0,0 +1,40 @@
# vim: set ts=2 sw=2 et ft=ruby:
# frozen_string_literal: true
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bookworm64'
config.vm.provider 'libvirt' do |domain|
domain.memory = 12_000
domain.nested = true
domain.cpu_mode = "host-model"
# domain.cpus = 2
#
domain.management_network_name = 'vagrant-libvirt-new'
domain.management_network_address = '192.168.124.0/24'
end
# config.vm.synced_folder '..', '/vagrant' #, type: 'nfs', mount_options: ['actimeo=2']
# config.vm.synced_folder '../../exercises', '/vagrant/exercises' #, type: 'nfs', mount_options: ['actimeo=2']
# config.vm.synced_folder '../../config', '/vagrant/config' #, type: 'nfs', mount_options: ['actimeo=2']
config.vm.define 'control' do |machine|
machine.vm.hostname = 'control'
[3000, 4000, 5000, 8000, 8080].each do |port|
machine.vm.network 'forwarded_port', guest: port, host: port, host_ip: '127.0.0.1'
end
machine.vm.network 'forwarded_port', guest: 80, host: 1080, host_ip: '127.0.0.1'
# machine.vm.network 'public_network', bridge: 'dummy0', auto_config: false
# machine.vm.network 'public_network', dev: 'br25', type: 'bridge', auto_config: false
machine.vm.network 'private_network', ip: '192.168.56.21', name: 'vagrant0'
machine.vm.network 'private_network', ip: '192.168.57.21', name: 'vagrant1'
machine.vm.network 'private_network', ip: '192.168.58.21', name: 'vagrant2'
end
config.vm.provision 'shell', name: 'provision/base', path: 'provision/base.sh', privileged: true
config.vm.provision 'shell', name: 'provision/openstack', path: 'provision/openstack.sh', privileged: false
config.vm.provision 'shell', inline: 'echo SUCCESS'
end

View file

@ -0,0 +1,15 @@
#!/bin/sh
echo "Installing required system packages"
apt-get update -qq --allow-releaseinfo-change
apt-get install -qq -y \
apt-transport-https \
ca-certificates \
git \
curl \
wget \
vim \
gnupg2 \
fzf \
software-properties-common

View file

@ -0,0 +1,104 @@
#!/bin/sh
# useradd -s /bin/bash -d /opt/stack -m stack
# chmod +x /opt/stack
# apt-get install sudo -y
# echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
##
## Install prerequisites
##
sudo apt-get install -y git bridge-utils
##
## Create network
##
# sudo tee /etc/network/interfaces.d/openstack >/dev/null <<MARK
# # auto eth1
# # iface dummy0 inet manual
# # pre-up ip link add dummy0 type dummy
#
# auto br25
# iface br25 inet static
# address 172.16.0.2/16
# bridge_ports eth1
# bridge_stp off
# bridge_maxwait 0
# bridge_fd 0
# MARK
# sudo ifup br25
##
## Get openstack
##
git clone https://opendev.org/openstack/devstack
cd devstack || exit 1
##
## Create configuration
##
## Ref. https://docs.openstack.org/devstack/latest/guides/neutron.html
##
cat > local.conf <<-MARK
[[local|localrc]]
## Pull changes from upstream on next run on stack.sh
RECLONE=True
HOST_IP=192.168.56.21
SERVICE_HOST=192.168.56.21
MYSQL_HOST=192.168.56.21
RABBIT_HOST=192.168.56.21
GLANCE_HOSTPORT=192.168.56.21:9292
ADMIN_PASSWORD=adminsecret
DATABASE_PASSWORD=databasesecret
RABBIT_PASSWORD=rabbitsecret
SERVICE_PASSWORD=servicesecret
## Do not use Nova-Network
disable_service n-net
## Enable Neutron
ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,neutron
## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.56.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.56.240,end=192.168.56.254
PUBLIC_NETWORK_GATEWAY="192.168.56.1"
PUBLIC_INTERFACE=eth1
## Open vSwitch provider networking configuration
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
## Additionnal SM added
GIT_BASE=$(GIT_BASE:-https://opendev.org)
# FIXME: broken because of mysql
# enable_plugin tacker https://opendev.org/openstack/tacker master
## Enable heat plugin
ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
enable_plugin heat https://opendev.org/openstack/heat master
## Disable tempest
disable_service tempest
## Enable mistral
enable_plugin mistral https://opendev.org/openstack/mistral
## Enable designate
## (buggy according to https://bugs.launchpad.net/designate/+bug/2036402)
# enable_plugin designate https://opendev.org/openstack/designate
MARK
##
## Run devstack
##
./stack.sh

View file

@ -0,0 +1,55 @@
#!/bin/sh
USER="$(test -d /vagrant && echo "vagrant")"
if test -z "$USER" && grep "^debian" /etc/passwd ; then USER="debian" ; fi
if test -z "$USER" && grep "^user" /etc/passwd ; then USER="user" ; fi
if [ -z "$USER" ] ; then
exit 1
fi
echo "root:root" | chpasswd
echo "$USER:$USER" | chpasswd
# FIXME: make sure that user is root or fail fast
# Install base unix tools
apt-get update
apt-get install -y git vim wget curl
# Install vagrant
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.asc
echo "deb [ signed-by=/usr/share/keyrings/hashicorp-archive-keyring.asc ] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install vagrant
# Install libvirt + qemu + kvm
# Ref. https://vagrant-libvirt.github.io/vagrant-libvirt/installation.html#ubuntu--debian
apt-get install -y qemu-utils libvirt-daemon-system libvirt-dev ebtables libguestfs-tools bridge-utils ruby-fog-libvirt
adduser "$USER" libvirt || true
# Install NFS
apt-get install -y nfs-kernel-server
# Give permission to libvirt group for NFS
cat > /etc/sudoers.d/vagrant-nfs <<-MARK
Cmnd_Alias VAGRANT_EXPORTS_CHOWN = /bin/chown 0\:0 /tmp/vagrant-exports
Cmnd_Alias VAGRANT_EXPORTS_MV = /bin/mv -f /tmp/vagrant-exports /etc/exports
Cmnd_Alias VAGRANT_NFSD_CHECK = /etc/init.d/nfs-kernel-server status
Cmnd_Alias VAGRANT_NFSD_START = /etc/init.d/nfs-kernel-server start
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar
%libvirt ALL=(root) NOPASSWD: VAGRANT_EXPORTS_CHOWN, VAGRANT_EXPORTS_MV, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY
MARK
# Install base requirements for vagrant plugins
apt-get install -y libxslt-dev libxml2-dev zlib1g-dev ruby-dev gcc make
# Make sure the embedded libraries match system libraries
if ! su "$USER" -c "vagrant plugin list" |grep '^vagrant-libvirt' ; then
echo "Installing vagrant-libvirt..."
su "$USER" -c "vagrant plugin install vagrant-libvirt" # --debug
else
echo "Skipping vagrant-libvirt (already installed)"
fi

View file

@ -0,0 +1,9 @@
#!/bin/sh
rm -f ~/src
ln -sf /vagrant ~/src
cd ~/src/inception || exit 1
vagrant up --provision

View file

@ -0,0 +1,8 @@
#!/bin/sh
export http_proxy="socks5://127.0.0.1:3128"
export https_proxy="socks5://127.0.0.1:3128"
export no_proxy="localhost,127.0.0.1"
echo "Warning: this terminal is now configured to use a SOCKS5 proxy"

View file

@ -0,0 +1,10 @@
#!/bin/sh
if [ ! -f ssh.config ] ; then
echo "Exporting ssh config"
vagrant ssh-config > ssh.config
fi
echo "Launching ssh proxy on port 3128. Press Ctrl-C to stop."
ssh -F ssh.config -D 3128 control -N