diff --git a/vm-1.devstack/Makefile b/vm-1.devstack/Makefile index a593fe4..11c7bf4 100644 --- a/vm-1.devstack/Makefile +++ b/vm-1.devstack/Makefile @@ -1,4 +1,6 @@ -zip: - zip -r kubernetes--lab.zip Vagrantfile provision.sh +zip: clean + zip -r devops--openstack--lab.zip Vagrantfile provision/ README.md +clean: + rm -f devops--openstack--lab.zip diff --git a/vm-1.devstack/README.md b/vm-1.devstack/README.md index 9754bed..85e216c 100644 --- a/vm-1.devstack/README.md +++ b/vm-1.devstack/README.md @@ -2,18 +2,21 @@ ## Setup the virtual machine -On the host machine +On the host machine, start the virtual machine: vagrant up --provider=libvirt + +Export the SSH configuration + vagrant ssh-config > ~/.ssh/config ## Setup tunnels -On the host machine +On the host machine (for students with a VM + devstack) ssh -L 8081:192.168.56.21:80 vagrant@control -N -On your local machine +On your local machine (for students with a specific bare metal installation) ssh -L8081:127.0.0.1:8081 debian@xxxx -N @@ -21,11 +24,19 @@ Then open your favorite web browser on the following address: http://localhost:8081/dashboard/ +## Setup CLI tools + + sudo apt-get install python3-pip + sudo pip3 install python-openstackclient + + # for a specific component (nova, neutron, etc.) + sudo pip3 install python-COMPONENTclient + ## Setup proxy (for openstack CLI) On the host machine - ssh -L 3128 vagrant@control -N + ssh -D 3128 vagrant@control -N export https_proxy=socks5://localhost:3128 export http_proxy=socks5://localhost:3128 @@ -35,7 +46,6 @@ The verify with the CLI: openstack image list - ## References * https://opendev.org/openstack/devstack-vagrant diff --git a/vm-1.devstack/Vagrantfile b/vm-1.devstack/Vagrantfile index 7a55a7f..6bc2dcc 100644 --- a/vm-1.devstack/Vagrantfile +++ b/vm-1.devstack/Vagrantfile @@ -21,6 +21,11 @@ Vagrant.configure('2') do |config| # 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.trigger.before :up do |trigger| + trigger.info = "Setup host bridges network config" + trigger.run = {path: "provision/local.sh"} + end + config.vm.define 'control' do |machine| machine.vm.hostname = 'control' @@ -30,11 +35,18 @@ Vagrant.configure('2') do |config| 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' + # + # REF + # machine.vm.network 'private_network', ip: '192.168.56.21', name: 'vagrant0' # , auto_config: false + # machine.vm.network 'private_network', ip: '192.168.57.21', name: 'vagrant1' # , auto_config: false + # machine.vm.network 'private_network', ip: '192.168.58.21', name: 'vagrant2' # , auto_config: false + + machine.vm.network 'public_network', ip: '192.168.56.21', dev: "os0", :mode => "bridge", :type => "bridge", auto_config: false + machine.vm.network 'public_network', ip: '192.168.57.21', dev: "os1", :mode => "bridge", :type => "bridge", auto_config: false + machine.vm.network 'public_network', ip: '192.168.58.21', dev: "os2", :mode => "bridge", :type => "bridge", auto_config: false end + config.vm.provision 'shell', name: 'provision/remote_network', path: 'provision/remote_network.sh', privileged: true 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' diff --git a/vm-1.devstack/provision/local.sh b/vm-1.devstack/provision/local.sh new file mode 100755 index 0000000..a328ad0 --- /dev/null +++ b/vm-1.devstack/provision/local.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +sudo ip link add os0 type bridge || true +sudo ip link add os1 type bridge || true +sudo ip link add os2 type bridge || true + +sudo ip link set os0 up || true +sudo ip link set os1 up || true +sudo ip link set os2 up || true diff --git a/vm-1.devstack/provision/remote_network.sh b/vm-1.devstack/provision/remote_network.sh new file mode 100755 index 0000000..b7dee85 --- /dev/null +++ b/vm-1.devstack/provision/remote_network.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +ip link set eth1 up || true +ip link set eth2 up || true +ip link set eth3 up || true +ip addr add 192.168.56.21/24 dev eth1 || true +ip addr add 192.168.57.21/24 dev eth2 || true +ip addr add 192.168.58.21/24 dev eth3 || true +ip route add 192.168.56.0/24 dev eth1 || true +ip route add 192.168.57.0/24 dev eth2 || true +ip route add 192.168.58.0/24 dev eth3 || true + +echo 'SUCCESS(remote_network)' diff --git a/vm-1.kayobe/URL.txt b/vm-1.kayobe/URL.txt new file mode 100644 index 0000000..d67e73a --- /dev/null +++ b/vm-1.kayobe/URL.txt @@ -0,0 +1,2 @@ +https://docs.openstack.org/kayobe/latest/contributor/vagrant.html + diff --git a/vm-1.kayobe/kayobe b/vm-1.kayobe/kayobe new file mode 160000 index 0000000..a46b78e --- /dev/null +++ b/vm-1.kayobe/kayobe @@ -0,0 +1 @@ +Subproject commit a46b78e594b996444e4498db04daf8ad50e544ca diff --git a/vm-1.vm-1.devstack/tools/proxy-env.sh b/vm-1.vm-1.devstack/inception/tools/proxy-env.sh similarity index 100% rename from vm-1.vm-1.devstack/tools/proxy-env.sh rename to vm-1.vm-1.devstack/inception/tools/proxy-env.sh diff --git a/vm-1.vm-1.devstack/tools/start-proxy.sh b/vm-1.vm-1.devstack/inception/tools/start-proxy.sh similarity index 100% rename from vm-1.vm-1.devstack/tools/start-proxy.sh rename to vm-1.vm-1.devstack/inception/tools/start-proxy.sh