Vagrantfile and vagrant.yml for testing
Also adds a readme file for vagrant. Change-Id: I46e60bdda83db8733019cdbcd8c2c326f3f1e1a8
This commit is contained in:
parent
01fb404431
commit
7b315c8b0f
36
README.vagrant
Normal file
36
README.vagrant
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Vagrant support for developers
|
||||||
|
==============================
|
||||||
|
Bifrost vagrant file for developers can be found in the tools/vagrant_dev_env
|
||||||
|
directory. Running 'vagrant up' from with in this folder will bring up an Ubuntu
|
||||||
|
Trusty box with bifrost installed.
|
||||||
|
|
||||||
|
By default the vm will have three interfaces:
|
||||||
|
eth0 - connected to a NAT network
|
||||||
|
eth1 - connected to Host-only network named: vboxnet1
|
||||||
|
eth2 - bridged - adapter must be set in Vagrantfile
|
||||||
|
|
||||||
|
|
||||||
|
Walkthrough done on OS X:
|
||||||
|
-------------------------
|
||||||
|
Setup vagrant by:
|
||||||
|
Installing git
|
||||||
|
Installing virtualbox
|
||||||
|
Installing vagrant
|
||||||
|
Installing ansible
|
||||||
|
|
||||||
|
Configure Vagrant with the correct box:
|
||||||
|
vagrant box add ubuntu/trusty64
|
||||||
|
|
||||||
|
Clone bifrost repo:
|
||||||
|
git clone https://github.com/openstack/bifrost.git
|
||||||
|
|
||||||
|
change in to the bifrost directory
|
||||||
|
cd bifrost/tools/vagrant_dev_env
|
||||||
|
|
||||||
|
edit Vagrantfile:
|
||||||
|
change public_key to correct key name
|
||||||
|
change network_interface to match your needs
|
||||||
|
change bridged adaptor
|
||||||
|
|
||||||
|
Boot the vm with:
|
||||||
|
vagrant up
|
1
doc/source/Vagrant.rst
Normal file
1
doc/source/Vagrant.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
.. include:: ../../README.vagrant
|
@ -8,6 +8,7 @@ Contents:
|
|||||||
|
|
||||||
readme
|
readme
|
||||||
contributing
|
contributing
|
||||||
|
Vagrant
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
47
tools/vagrant_dev_env/Vagrantfile
vendored
Normal file
47
tools/vagrant_dev_env/Vagrantfile
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
VAGRANTFILE_API_VERSION = '2'
|
||||||
|
|
||||||
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
|
|
||||||
|
config.vm.box = 'ubuntu/trusty64'
|
||||||
|
|
||||||
|
config.vm.define 'bifrost' do |bifrost|
|
||||||
|
bifrost.vm.provider :virtualbox do |vb|
|
||||||
|
vb.customize ['modifyvm', :id, '--memory', '4096', '--cpus', '1', '--cpuexecutioncap', '80']
|
||||||
|
# the setting below are to improve performance on mac's and should have little impact elsewhere.
|
||||||
|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
||||||
|
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
|
||||||
|
vb.customize ["modifyvm", :id, "--nictype2", "Am79C973"]
|
||||||
|
vb.customize ["modifyvm", :id, "--nictype3", "Am79C973"]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set up private NAT'd network
|
||||||
|
bifrost.vm.network 'private_network', ip: '192.168.99.10' # it goes to 11
|
||||||
|
# This assumes you have DHCP on your bridged network. if not you will need
|
||||||
|
# to statically configure to allow Bifrost to manage hardware attached to
|
||||||
|
# the bridged interface.
|
||||||
|
# NOTE(TheJulia): Is there a way to abstract the bridged networking...
|
||||||
|
# NOTE(NobodyCam): until the above is done this needs to be set to a valid interface
|
||||||
|
bifrost.vm.network 'public_network', bridge: ''
|
||||||
|
|
||||||
|
# besure we get the entire bifrost directory tree
|
||||||
|
bifrost.vm.synced_folder "../../.", "/home/vagrant/bifrost", type: "rsync"
|
||||||
|
|
||||||
|
bifrost.vm.provision 'ansible' do |ansible|
|
||||||
|
ansible.verbose = 'v'
|
||||||
|
ansible.playbook = 'vagrant.yml'
|
||||||
|
ansible.extra_vars = {
|
||||||
|
# set key file name here
|
||||||
|
public_key: 'id_rsa.pub',
|
||||||
|
# Edit the network_interface to match your needs:
|
||||||
|
# eth0 - connected to a Nat network
|
||||||
|
# eth1 - connected to Host-only network named: 'vboxnet1'
|
||||||
|
# eth2 - bridged - Interface must also be set above
|
||||||
|
network_interface: 'eth2'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
75
tools/vagrant_dev_env/vagrant.yml
Normal file
75
tools/vagrant_dev_env/vagrant.yml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
#
|
||||||
|
- hosts: bifrost
|
||||||
|
sudo: yes
|
||||||
|
tasks:
|
||||||
|
############################################################################
|
||||||
|
# Install some reqired bits into the vm
|
||||||
|
############################################################################
|
||||||
|
# Make sure our VM's software is ~@Latest
|
||||||
|
- name: Apt Update
|
||||||
|
apt: update_cache=yes
|
||||||
|
upgrade=dist
|
||||||
|
cache_valid_time=86400
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install easy_install
|
||||||
|
apt: name=python-setuptools state=present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install python-dev
|
||||||
|
apt: name=python-dev state=present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
# these would also be installed by 'Prepare VM for Bifrost'
|
||||||
|
# below As they are larger packages I think its worth installing
|
||||||
|
# them on their own.
|
||||||
|
- name: Install erlang-base
|
||||||
|
apt: name=erlang-base state=present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install Rabbit-Server
|
||||||
|
apt: name=rabbitmq-server state=present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install MySql-Server
|
||||||
|
apt: name=mysql-server state=present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
# get ip for public_network
|
||||||
|
- name: Get ip
|
||||||
|
shell: ip addr show eth2 | grep inet | grep -v inet6 | awk '{print $2}' | cut -d/ -f1
|
||||||
|
register: guest_ip
|
||||||
|
|
||||||
|
# Reboot if required.
|
||||||
|
- name: Reboot system if required
|
||||||
|
command: shutdown -r now 'Rebooting to complete system upgrade'
|
||||||
|
removes=/var/run/reboot-required
|
||||||
|
register: rebooted
|
||||||
|
- name: Wait for VM Reboot.
|
||||||
|
sudo: no
|
||||||
|
local_action: wait_for
|
||||||
|
port=22
|
||||||
|
host="{{guest_ip.stdout}}"
|
||||||
|
search_regex=OpenSSH
|
||||||
|
delay=10
|
||||||
|
timeout=900
|
||||||
|
when: rebooted.changed
|
||||||
|
|
||||||
|
- name: Copy SSH public key into VM
|
||||||
|
copy: src=~/.ssh/{{public_key}} dest=~/.ssh/id_rsa.pub
|
||||||
|
|
||||||
|
- name: Ensure /opt/stack folder exists
|
||||||
|
file: path=/opt/stack state=directory owner=vagrant
|
||||||
|
|
||||||
|
- name: Prepare VM for Bifrost
|
||||||
|
command: /home/vagrant/bifrost/scripts/env-setup.sh
|
||||||
|
|
||||||
|
- name: Install Bifrost
|
||||||
|
shell: source /opt/stack/ansible/hacking/env-setup && ansible-playbook -vvvv -i inventory/localhost install.yaml -e network_interface={{network_interface}}
|
||||||
|
args:
|
||||||
|
chdir: /home/vagrant/bifrost/playbooks
|
||||||
|
executable: /bin/bash
|
||||||
|
|
Loading…
Reference in New Issue
Block a user