Commit e705016f authored by Daniele Santoro's avatar Daniele Santoro
Browse files

Release lab lesson 5

parent 052ac271
......@@ -45,4 +45,5 @@ by us distributing a =Vagrantfile= and a =provisioning script=.
- [[file:e14][Exercise 14 – Run a Service with Docker]]
- [[file:e15][Exercise 15 - Run a custom Service with Docker]]
- [[file:e16][Exercise 16 - Run a custom Docker Service with persistency]]
* Lab05_20220422
- [[file:e17][Exercise 17 - Create an OpenStack instance based on DevStack]]
......@@ -22,7 +22,6 @@
** Build the image
cd e4
docker build -t${USER: -3} .
** List all images
* Exercise 17 – Create an OpenStack instance based on DevStack
- Time :: 40 minutes
- 40 minutes: /Try by yourself/
- Description :: Install OpenStack using DevStack on a dedicated virtual machine.
* Solutions and Instructions
** References
- [[]]
- [[]]
** Provision the OpenStack VM using Vagrant
The specs for this Virtual Machine are quite huge: =6GB of memory= and =4 vCPU= so please ensure to have enough free resoruces on your host.
#+begin_src sh
vagrant up
** Prepare DevStack environement
Download the DevStack release
#+begin_src sh
vagrant ssh
cd /vagrant
chmod a+x
sudo -u stack ./
Customise DevStack environment
#+begin_src sh
sudo -s -u stack
cp /vagrant/localrc.conf devstack/local.conf
Customise =local.conf= with VM ip, first get the IP
#+begin_src sh
hostname -I | awk '{print $1}'
Edit =devstack/local.conf= and add this line at the top
#+begin_src sh
You should get something liek this:
** Install the DevStack environement
This step could last ~40 minutes
#+begin_src sh
cd devstack
At the end of the process you should get a message like this:
DevStack Component Timing
(times are in seconds)
wait_for_service 19
pip_install 374
apt-get 272
run_process 31
dbsync 41
git_timed 545
apt-get-update 3
test_with_retry 3
osc 238
Unaccounted time 421
Total runtime 1947
This is your host IP address:
This is your host IPv6 address: ::1
Horizon is now available at
Keystone is serving at
The default users are: admin and demo
The password: password
Setup you SSH-based socks proxy and access and access with a browser to =
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# Every Vagrant development environment requires a box. You can search for
# boxes at = "ubuntu/focal64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via to disable public access
# "forwarded_port", guest: 80, host: 8080, host_ip: ""
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# "private_network", ip: ""
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "6144"
vb.cpus = "4"
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# Shared configuration
config.vm.provision :ansible do |ansible|
ansible.verbose = ANSIBLE_LOGLEVEL
ansible.playbook = ANSIBLE_PLAYBOOK
output: {all: '| tee -a /var/log/cloud-init-output-script.log'}
- dstat
- git
- htop
- linux-image-extra-virtual
- rsync
- tmux
- screen
- vim
- wget
- jq
- emacs-nox
- snapd
package_update: true
package_upgrade: true
package_reboot_if_required: true
- default
- name: stack
lock_passwd: true
sudo: ["ALL=(ALL) NOPASSWD:ALL\nDefaults:stack !requiretty"]
shell: /bin/bash
- path: "/home/stack/local.conf"
permissions: "0755"
encoding: b64
content: "{{lookup('file', 'localrc.conf')|b64encode }}"
- path: "/home/stack/"
permissions: "0755"
content: |
set -x
set -e
sudo chown stack:stack /home/stack
cd /home/stack
git clone -b "${OS_VERSION}"
cd devstack
echo enable_plugin swift "${OS_VERSION}" >> local.conf
- sudo -u stack -i ./
- sudo -u stack -i mv local.conf devstack
- sudo -u stack -i sh -c 'cd devstack && ./'
set -x
set -e
sudo chown stack:stack /home/stack
cd /home/stack
git clone -b "${OS_VERSION}"
cd devstack
echo enable_plugin swift "${OS_VERSION}" >> local.conf
enable_service s-proxy s-object s-container s-account
enable_plugin swift stable/victoria
# # Install the Magnum service (K8s cluster manager) and its GUI
# # Magnum requires the Heat service (cloud application orchestration)
# enable_plugin heat stable/victoria
# enable_plugin heat-dashboard stable/victoria
# enable_plugin magnum stable/victoria
# enable_plugin magnum-ui stable/victoria
# # Install the Octavia service (load balancer) and its GUI
# # Barbican (service for storing secrets) is probably optional.
# enable_plugin barbican stable/victoria
# # enable_plugin barbican_ui master
# # enable_service rabbit mysql key
# enable_plugin octavia stable/victoria
# enable_plugin octavia-dashboard stable/victoria
# # ENABLED_SERVICES+=,octavia,o-api,o-cw,o-hk,o-hm,o-da
# enable_service octavia o-api o-cw o-hm o-hk o-da
# enable_plugin ceilometer stable/victoria
# enable_plugin aodh stable/victoria
# # Enable Cinder-Backup
# enable_service c-bak
# /var/opt/stack/openstack_dashboard/local/local_settings.d/
# 'enable_backup': True,
# }
# Tempest
# enable_service tempest
# File: provision.yml - Install devstack
- hosts: all
become: true
- name: Upgrade the OS (apt-get dist-upgrade)
upgrade: dist
- name: Run the equivalent of "apt-get update" as a separate step
update_cache: yes
- name: Install packages
- dstat
- git
- htop
- rsync
- tmux
- screen
- vim
- wget
- jq
- snapd
- name: Add the user 'stack'
name: stack
shell: /bin/bash
home: /home/stack
groups: admin, sudo
append: yes
- name: Allow 'stack' to have passwordless sudo
dest: /etc/sudoers
state: present
regexp: '^%stack'
line: '%stack ALL=(ALL) NOPASSWD: ALL'
validate: 'visudo -cf %s'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment