mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Commit initial set of files
Commit initial Vagrantfile, YAML data file, and preliminary README.md. Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
parent
768e6c4df0
commit
7560c84b5c
3 changed files with 121 additions and 0 deletions
25
ovs-ovn/ovs-fedora-atomic/README.md
Normal file
25
ovs-ovn/ovs-fedora-atomic/README.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Running OVS on Fedora Atomic Host
|
||||
|
||||
**THIS AREA IS NOT YET FUNCTIONAL**
|
||||
|
||||
These files were created to allow users to use Vagrant ([http://www.vagrantup.com](http://www.vagrantup.com)) to quickly and easily spin up an environment that shows how to run Open vSwitch (OVS) on a Fedora Atomic Host system.
|
||||
|
||||
## Contents
|
||||
|
||||
* **machines.yml**: This YAML file contains a list of VM definitions and associated configuration data. It is referenced by `Vagrantfile` when Vagrant instantiates the VMs.
|
||||
|
||||
* **README.md**: This file you're currently reading.
|
||||
|
||||
* **Vagrantfile**: This file is used by Vagrant to spin up the virtual machines. This file is fairly extensively commented to help explain what's happening. You should be able to use this file unchanged; all the VM configuration options are stored outside this file.
|
||||
|
||||
## Instructions
|
||||
|
||||
These instructions assume you've already installed your virtualization provider (VMware Fusion/Workstation or VirtualBox), Vagrant, and any necessary plugins (such as the Vagrant VMware plugin). Please refer to the documentation for those products for more information on installation or configuration.
|
||||
|
||||
1. Use `vagrant box add` to add a Fedora Atomic Host base box to be used by this `Vagrantfile`. (This environment was tested using Fedora 27 Atomic Host.) You'll need to specify a box that provides support for the virtualization provider you're planning to use. The existing `machines.yml` file provides some suggested boxes.
|
||||
|
||||
2. If you decide to use a box _other_ than one listed in `machines.yml`, edit `machines.yml` to specify the name of the box you added in step 1. In `machines.yml`, the "vmw" line is for a VMware-formatted box, the "vb" line is for the name of a VirtualBox-formatted box, and the "lv" line is for the name of a box that supports the Libvirt provider. Edit the appropriate line based on your virtualization provider and the name of the box you added in step 1.
|
||||
|
||||
3. Run `vagrant up`, and when the VM is up use `vagrant ssh` to access the VM.
|
||||
|
||||
Enjoy!
|
||||
84
ovs-ovn/ovs-fedora-atomic/Vagrantfile
vendored
Normal file
84
ovs-ovn/ovs-fedora-atomic/Vagrantfile
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Specify minimum Vagrant version and Vagrant API version
|
||||
Vagrant.require_version '>= 1.6.0'
|
||||
VAGRANTFILE_API_VERSION = '2'
|
||||
|
||||
# Require 'yaml' module
|
||||
require 'yaml'
|
||||
|
||||
# Read YAML file with VM details (box, CPU, RAM, IP addresses)
|
||||
# Edit machines.yml to change VM configuration details
|
||||
machines = YAML.load_file(File.join(File.dirname(__FILE__), 'machines.yml'))
|
||||
|
||||
# Create and configure the VMs
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
# Always use Vagrant's default insecure key
|
||||
config.ssh.insert_key = false
|
||||
|
||||
# Iterate through entries in YAML file to create VMs
|
||||
machines.each do |machine|
|
||||
|
||||
# Configure the VMs per details in machines.yml
|
||||
config.vm.define machine['name'] do |srv|
|
||||
|
||||
# Don't check for box updates
|
||||
srv.vm.box_check_update = false
|
||||
|
||||
# Specify the hostname of the VM
|
||||
srv.vm.hostname = machine['name']
|
||||
|
||||
# Specify the Vagrant box to use (use VMware box by default)
|
||||
srv.vm.box = machine['box']['vmw']
|
||||
|
||||
# Configure default synced folder (disable by default)
|
||||
if machine['sync_disabled'] != nil
|
||||
srv.vm.synced_folder '.', '/vagrant', disabled: machine['sync_disabled']
|
||||
else
|
||||
srv.vm.synced_folder '.', '/vagrant', disabled: true
|
||||
end #if machine['sync_disabled']
|
||||
|
||||
# Iterate through networks as per settings in machines.yml
|
||||
machine['nics'].each do |net|
|
||||
if net['ip_addr'] == 'dhcp'
|
||||
srv.vm.network net['type'], type: net['ip_addr']
|
||||
else
|
||||
srv.vm.network net['type'], ip: net['ip_addr']
|
||||
end # if net['ip_addr']
|
||||
end # machine['nics'].each
|
||||
|
||||
# Assign additional private network
|
||||
#if machine['ip_addr'] != nil
|
||||
# srv.vm.network 'private_network', ip: machine['ip_addr']
|
||||
#end # if machine['ip_addr']
|
||||
|
||||
# Configure CPU & RAM per settings in machines.yml (Fusion)
|
||||
srv.vm.provider 'vmware_fusion' do |vmw|
|
||||
vmw.vmx['memsize'] = machine['ram']
|
||||
vmw.vmx['numvcpus'] = machine['vcpu']
|
||||
if machine['nested'] == true
|
||||
vmw.vmx['vhv.enable'] = 'TRUE'
|
||||
end #if machine['nested']
|
||||
end # srv.vm.provider 'vmware_fusion'
|
||||
|
||||
# Configure CPU & RAM per settings in machines.yml (VirtualBox)
|
||||
srv.vm.provider 'virtualbox' do |vb, override|
|
||||
vb.memory = machine['ram']
|
||||
vb.cpus = machine['vcpu']
|
||||
override.vm.box = machine['box']['vb']
|
||||
end # srv.vm.provider 'virtualbox'
|
||||
|
||||
# Configure CPU & RAM per settings in machines.yml (Libvirt)
|
||||
srv.vm.provider 'libvirt' do |lv,override|
|
||||
lv.memory = machine['ram']
|
||||
lv.cpus = machine['vcpu']
|
||||
override.vm.box = machine['box']['lv']
|
||||
if machine['nested'] == true
|
||||
lv.nested = true
|
||||
end # if machine['nested']
|
||||
end # srv.vm.provider 'libvirt'
|
||||
end # config.vm.define
|
||||
end # machines.each
|
||||
end # Vagrant.configure
|
||||
12
ovs-ovn/ovs-fedora-atomic/machines.yml
Normal file
12
ovs-ovn/ovs-fedora-atomic/machines.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
- box:
|
||||
vmw: "bento/debian-9.2"
|
||||
vb: "fedora/27-atomic-host"
|
||||
lv: "fedora/27-atomic-host"
|
||||
name: "atomic-01"
|
||||
nested: false
|
||||
nics:
|
||||
- type: "private_network"
|
||||
ip_addr: "dhcp"
|
||||
ram: "1024"
|
||||
vcpu: "1"
|
||||
Loading…
Reference in a new issue