Requires vagrant 2.1.2+ due to bug: hashicorp/vagrant#10158 , I've used 2.1.5 from https://www.vagrantup.com/downloads.html (installed it on my ubuntu 18.04 from debian 64-bit package).
wget https://releases.hashicorp.com/vagrant/2.1.5/vagrant_2.1.5_x86_64.deb
dpkg -i vagrant_2.1.5_x86_64.deb
- in virtualbox, connect to port 3622 with ssh
- Install dependencies (on ubuntu 18.04)
sudo apt-get -y install build-essential git ruby lxc lxc-templates cgroup-lite redir
- install vagrant plugin
vagrant plugin install vagrant-lxc
- up with lxc provider
vagrant up --provider=lxc
Based on https://blog.scottlowe.org/2017/12/11/using-vagrant-with-azure/
- Install azure cli https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
- Install vagrant plugin
vagrant plugin install vagrant-azure
- auth with az tools: https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest
- Create a dummy box
vagrant box add azure-dummy https://github.com/azure/vagrant-azure/raw/v2.0/dummy.box --provider azure
- Create your service principal and save the output
az ad sp create-for-rbac
- get your account information
az account show
- Create your env file and fill it in a safe place, no spaces between
=
and other symbols,source envfile
at the end.
AZURE_TENANT_ID="put value of tenant from az ad sp create-for-rbac output"
AZURE_CLIENT_ID="put value of appId from az ad sp create-for-rbac output"
AZURE_CLIENT_SECRET="put value of password from az ad sp create-for-rbac output"
AZURE_SUBSCRIPTION_ID="put value of id from az account show output"
export AZURE_TENANT_ID AZURE_CLIENT_ID AZURE_CLIENT_SECRET AZURE_SUBSCRIPTION_ID
- In any bash shell intended for running vagrant up or ssh or destroy commands source access variables with
source envfile
- Modify playbook.yml to have strong passwords for vagrant and dbaN accounts.
- Modify
Vagrantfile:az.vm_name
if needed (and VM size, currently it's 1 core & 1GB) - Uncomment
require azure-plugin
at the beginning of Vagrantfile to avoid error:The resource group 'vagrant' is in deprovisioning state and cannot perform this operation.
- Start vagrant box
vagrant up --provider=azure
- Wait until creation and ansible run will be finished
- Connect with attender account:
ssh dbaN@tutorialengine.westus.cloudapp.azure.com
where N from 1 to 50 - Do not forget to remove VM after work to avoid wasting money:
vagrant destroy -f
- Check at https://portal.azure.com, VM should be destroyed completely after 10-15 minutes (Delete procedure is really slow)
https://github.com/mitchellh/vagrant-aws
- Install provider
vagrant plugin install vagrant-aws
vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
- Update Vagrant file to provide your account details. If aws configure was executed on your machine it's enough to change just:
override.ssh.private_key_path = '~/.ssh/id_rsa-hadar'
aws.keypair_name = "nickolay.ihalainen"
- Start the box
vagrant up --provider=aws
- ssh dba1@ip
- Do not forget to shutdown with
vagrant destroy -f
to save money
- More to follow
vagrant ssh
- Start vagrant box:
vagrant up --provider=virtualbox
- Change something - then:
- Update push changes to existing vagrant box:
vagrant provision
- When you finished for today stop box:
vagrant halt
- If you have created, but stopped box you can start it:
vagrant up
- Renaming task files:
- login to box:
vagrant ssh
- remove existing task files in box:
rm -rf tutorial/*
- exit from vagrant ssh
- push all tutorial files to the box:
vagrant provision
- During demonstration you should have pre-configured halted box, just start it:
vagrant up
. The box is already provisioned, thus it will not require internet connection to start.
playbook.yml
file contains declarations what packages and files should be in the box. In order to add new packages add following lines before # keep allow password login at the end
comment:
- name: install sysbench
package:
name: sysbench
update_cache: no
state: present
update_cache: yes
instructs ansible to run apt update
before installing package.
Be careful with spaces and tabs, yml format is like a python programming language.