Daniel Farrell
Software Engineer, Red Hat SDN Team
[~]$ mkdir foss_rocks
[~]$ cd foss_rocks
[~/foss_rocks]$ vagrant init -m chef/fedora-20
[~/foss_rocks]$ ls
Vagrantfile
[~/foss_rocks]$ cat Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "chef/fedora-20"
end
[~/foss_rocks]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'chef/fedora-20' is up to date...
==> default: Preparing network interfaces based on configuration...
==> default: Booting VM...
==> default: Machine booted and ready!
==> default: Mounting shared folders...
default: /vagrant => /home/daniel/foss_rocks
[~/foss_rocks]$ vagrant ssh
Last login: Fri Dec 20 18:02:34 2013 from 10.0.2.2
[vagrant@localhost ~]$
[vagrant@localhost ~]$ ping 8.8.8.8 -c 1
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=63 time=13.7 ms
[vagrant@localhost ~]$ cat /etc/issue
Fedora release 20 (Heisenbug)
[vagrant@localhost ~]$ ls /vagrant/
Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "chef/fedora-20"
config.vm.provision "shell", inline: "yum install -y nmap"
end
[~/foss_rocks]$ vagrant status
Current machine states:
default running (virtualbox)
[~/foss_rocks]$ vagrant provision
==> default: Running provisioner: shell...
default: Running: inline script
[snip]
==> default: Installed:
==> default: nmap.x86_64 2:6.45-1.fc20
[~/foss_rocks]$ vagrant ssh
Last login: Fri Feb 6 16:03:05 2015 from 10.0.2.2
[vagrant@localhost ~]$ command -v nmap
/usr/bin/nmap
Vagrant.configure(2) do |config|
config.vm.box = "chef/fedora-20"
# Install Puppet
config.vm.provision "shell", inline: "yum install -y puppet"
# Install OpenDaylight using its Puppet module
config.vm.provision "puppet" do |puppet|
# Mostly using default settings
# The module path tells Puppet where to find required modules
puppet.module_path = ["modules"]
end
end
config.vm.provision "puppet" do |puppet|
# Mostly using default settings
# The module path tells Puppet where to find required modules
puppet.module_path = ["modules"]
end
[~/foss_rocks]$ tree
.
├── manifests
│ └── default.pp
└── Vagrantfile
[~/foss_rocks]$ cat manifests/default.pp
include ::opendaylight
[~/foss_rocks]$ tree
.
├── Gemfile
├── manifests
│ └── default.pp
├── Puppetfile
└── Vagrantfile
[~/foss_rocks]$ cat Gemfile
source "https://rubygems.org"
gem 'puppet'
gem 'librarian-puppet' # Used for managing Puppet mods
[~/foss_rocks]$ cat Puppetfile
#!/usr/bin/env ruby
forge "https://forgeapi.puppetlabs.com"
mod 'dfarrell07-opendaylight',
:git => 'git://github.com/dfarrell07/puppet-opendaylight.git'
[~/foss_rocks]$ bundle install
[snip]
Your bundle is complete!
[~/foss_rocks]$ ls
Gemfile manifests Puppetfile Vagrantfile
[~/foss_rocks]$ librarian-puppet install
[~/foss_rocks]$ tree -L 2
.
├── Gemfile
├── manifests
│ └── default.pp
├── modules
│ ├── opendaylight
│ └── stdlib
├── Puppetfile
├── Puppetfile.lock
└── Vagrantfile
[~/foss_rocks]$ vagrant destroy -f
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
==> default: Running cleanup tasks for 'shell' provisioner...
[~/foss_rocks]$ vagrant status
Current machine states:
default not created (virtualbox)
[~/foss_rocks]$ vagrant up
==> default: Running provisioner: shell...
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: Notice: Finished catalog run in 59.59 seconds
[~/foss_rocks]$ vagrant ssh
Last login: Fri Dec 20 18:02:34 2013 from 10.0.2.2
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
# Configure VM RAM and CPU
config.vm.provider "virtualbox" do |vbox|
vbox.memory = 2048
vbox.cpus = 4
end
[~/foss_rocks]$ vagrant status
Current machine states:
default running (virtualbox)
[~/foss_rocks]$ pgrep VBoxHeadless
5822
[~/foss_rocks]$ vagrant up --provider=digital_ocean
Bringing machine 'default' up with 'digital_ocean' provider...
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = "~/.ssh/id_rsa"
override.vm.box = "digital_ocean"
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
provider.token = "<token here>"
provider.image = "centos-7-0-x64"
provider.region = "nyc3"
provider.size = "512mb"
end
[~/foss_rocks]$ vagrant ssh
[root@default ~]# ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=1.86 ms
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "cent7_puppet" do |cent7_puppet|
# Configure CentOS 7 box using Puppet
to install ODL
end
config.vm.define "fed20_puppet" do |fed20_puppet|
# Configure Fedora 20 box using Puppet
to install ODL
end
config.vm.define "fed20_rpm" do |fed20_rpm|
# Configure Fedora 20 box using RPM to install ODL
end
config.vm.define "cent7_rpm" do |cent7_rpm|
# Configure CentOS 7 box using RPM to install ODL
end
config.vm.define "cent7_puppet" do |cent7_puppet|
# Build Vagrant box based on CentOS 7
cent7_puppet.vm.box = "chef/centos-7.0"
# Add Puppet repo and install Puppet
cent7_puppet.vm.provision "shell", inline: "rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm"
cent7_puppet.vm.provision "shell", inline: "yum install -y puppet"
# Snip: Puppet provisioning step
end
config.vm.define "fed20_puppet" do |fed20_puppet|
# Build Vagrant box based on Fedora 20
fed20_puppet.vm.box = "chef/fedora-20"
# Install Puppet
fed20_puppet.vm.provision "shell", inline: "yum install -y puppet"
# Snip: Puppet provisioning step
end
[~/vagrant_opendaylight]$ vagrant status
Current machine states:
cent7_puppet not created (virtualbox)
fed20_puppet poweroff (virtualbox)
By Daniel Farrell
Talk given at the NCSU LUG's 2015 FOSS Fair