aboutsummaryrefslogtreecommitdiffstats
path: root/vagrant/pxe
diff options
context:
space:
mode:
Diffstat (limited to 'vagrant/pxe')
-rwxr-xr-xvagrant/pxe/Vagrantfile121
-rwxr-xr-xvagrant/pxe/lib/vagrant_provision.rb71
-rwxr-xr-xvagrant/pxe/multi_node_config.yml127
-rwxr-xr-xvagrant/pxe/single_node_config.yml88
4 files changed, 407 insertions, 0 deletions
diff --git a/vagrant/pxe/Vagrantfile b/vagrant/pxe/Vagrantfile
new file mode 100755
index 0000000..bd860f9
--- /dev/null
+++ b/vagrant/pxe/Vagrantfile
@@ -0,0 +1,121 @@
+# -*- encoding: utf-8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# -*- mode: ruby -*-
+# # vi: set ft=ruby :
+require_relative 'lib/vagrant_provision.rb'
+
+Vagrant.require_version ">= 1.6.0"
+if ENV["VVP_DEVKIT"].nil? or ENV["VVP_DEVKIT"].downcase == "single"
+ yaml_conf = YAML.load_file(File.join(File.dirname(__FILE__),'single_node_config.yml'))
+else
+ yaml_conf = YAML.load_file(File.join(File.dirname(__FILE__),'multi_node_config.yml'))
+end
+
+Vagrant.configure("2") do |config|
+
+ # always use Vagrant's insecure key
+ config.ssh.insert_key = false
+
+ # plugin conflict
+ if Vagrant.has_plugin?("vagrant-vbguest") then
+ config.vbguest.auto_update = false
+ end
+
+ yaml_conf["boxen"].each do |box|
+ config.vm.define box["name"] do |conf|
+ conf.vm.box = box["box"]
+ conf.vm.network :forwarded_port, guest: 22, host: box["vagrant_ssh_port"], id: "ssh"
+ conf.vm.box_check_update = false
+ conf.vm.synced_folder '.', '/vagrant', disabled: true
+ ["vmware_fusion", "vmware_workstation"].each do |vmware|
+ conf.vm.provider vmware do |v, override|
+ v.vmx['numvcpus'] = box["cpus"]
+ v.vmx['memsize'] = box["memory"]
+ v.gui = false
+
+ override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json" % $update_channel
+ end # vmware
+ end # override
+
+ conf.vm.provider :virtualbox do |v|
+ v.cpus = box["cpus"]
+ v.gui = false
+ v.memory = box["memory"]
+
+ # On VirtualBox, we don't have guest additions or a functional vboxsf
+ # in CoreOS, so tell Vagrant that so it can be smarter.
+ v.check_guest_additions = false
+ v.functional_vboxsf = false
+
+ if box["groups"].include? "coreos" then
+ # Vagrant overrides Virtualbox's default which causes 5-10s slowdown for
+ # dns queries in kubernetes containers. Turn it back off!
+ v.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
+ v.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
+ end
+
+ # TODO: move to custom ceph image if possible
+ ceph_disk = File.join(File.dirname(__FILE__), 'files', 'ceph_disk.vdi')
+ if box["groups"].include? "osds" then
+ v.customize ['createhd', '--filename', ceph_disk, '--size', 500 * 1024] unless File.exists? ceph_disk
+ v.customize ['storageattach', :id, '--storagectl', "IDE", '--port', 1, '--device', 0, '--type', 'hdd', '--medium', ceph_disk]
+ end
+
+ end # v
+
+ conf.vm.network :private_network,
+ :adapter => 2,
+ :ip => box["ips"][0],
+ :mac => box["macs"][0],
+ :nic_type => "virtio"
+
+ conf.vm.network :private_network,
+ :adapter => 3,
+ :ip => box["ips"][1],
+ :mac => box["macs"][1],
+ :nic_type => "virtio",
+ :type => :static
+
+ if box["groups"].include? "centos" then
+ conf.vm.provision "shell", inline: "systemctl restart NetworkManager; ifdown eth1; ifup eth1"
+ end
+ provision(box, yaml_conf["boxen"], yaml_conf["hosts"], conf)
+ end # conf
+ end # box
+end # config
diff --git a/vagrant/pxe/lib/vagrant_provision.rb b/vagrant/pxe/lib/vagrant_provision.rb
new file mode 100755
index 0000000..67ccb63
--- /dev/null
+++ b/vagrant/pxe/lib/vagrant_provision.rb
@@ -0,0 +1,71 @@
+# -*- encoding: utf-8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+require "pathname"
+
+def provision(box, boxen, hosts, conf)
+
+ ansible_groups = Hash.new { |h,k| h[k] = [] }
+ boxen.each do |box|
+ box["groups"].each do |group|
+ ansible_groups[group] << box["name"]
+ end
+ end
+
+ defined_vms = boxen.map {|b| b["name"]}
+
+ requested_vms = defined_vms & ARGV
+ if requested_vms.empty?
+ requested_vms = defined_vms
+ end
+
+ provisioning_groups = [ 'bootstrap', 'ceph', 'container-hosts' ]
+ provisioning_group = (box["groups"] & provisioning_groups).last
+ return unless provisioning_group
+ return unless box["name"] == (requested_vms & ansible_groups[provisioning_group]).last
+
+ conf.vm.provision "ansible" do |ansible|
+ # note: ansible is launched from root_path, so paths specified here are relative to that.
+ ansible.extra_vars = {hosts: hosts}
+ ansible.groups = ansible_groups
+ ansible.limit = [provisioning_group,"127.0.0.1"]
+ ansible.playbook = Pathname(ENV["ANSIBLE_CONFIG"]).parent.join("infrastructure.yml").to_path
+ ansible.vault_password_file = ENV["ANSIBLE_VAULT_PASSWORD_FILE"]
+ ansible.inventory_path = Pathname(ENV["DEVKIT_ZONE_DIR"]).join("inventory").to_path
+ end
+end # ansible
diff --git a/vagrant/pxe/multi_node_config.yml b/vagrant/pxe/multi_node_config.yml
new file mode 100755
index 0000000..2f92e52
--- /dev/null
+++ b/vagrant/pxe/multi_node_config.yml
@@ -0,0 +1,127 @@
+# -*- encoding: utf-8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+boxen:
+ - name: ops-01
+ box: centos/7
+ ips: ['10.252.0.2', "10.220.220.2"]
+ macs: []
+ cpus: 2
+ cpu: "50"
+ memory: "1024"
+ groups: ["bootstrap", "centos",]
+ vagrant_ssh_port: 2502
+
+ - name: ceph-01
+ box: centos/7
+ ips: ["10.252.0.21", "10.220.220.21"]
+ cpus: 2
+ cpu: 50
+ memory: 1024
+ macs: ["0800276695A1","0800276695A2"]
+ groups: ["ceph", "osds", "mons", "rgws", "rbdhost", "centos"]
+ vagrant_ssh_port: 2521
+
+ - name: coreos-01
+ box: vvp-empty
+ cpus: 1
+ cpu: 50
+ memory: 2048
+ macs: ["08002766959E","08002766958E"]
+ ips: ["10.252.0.12", "10.220.220.12"]
+ groups: ["coreos", "container-hosts", "fleetctl-host"]
+ vagrant_ssh_port: 2512
+
+ - name: coreos-02
+ box: vvp-empty
+ cpus: 1
+ cpu: "50"
+ memory: "2048"
+ macs: ["08002766959F", "08002766958F"]
+ ips: ["10.252.0.13", "10.220.220.13"]
+ groups: ["coreos", "container-hosts",]
+ vagrant_ssh_port: 2513
+
+ - name: coreos-03
+ box: vvp-empty
+ cpus: 1
+ cpu: "50"
+ memory: "2048"
+ macs: ["0800276695A0","0800276695A3"]
+ ips: ["10.252.0.14", "10.220.220.14"]
+ groups: ["coreos", "container-hosts",]
+ vagrant_ssh_port: 2514
+
+hosts:
+ - name: "coreos-01"
+ ssh_ip: 10.0.2.15
+ mac: "08:00:27:66:95:9E"
+ dnsmasq_config:
+ - "08:00:27:66:95:9E,10.252.0.12,coreos-01,infinite,set:coreos"
+ - "08:00:27:66:95:8E,10.220.220.12,coreos-01,infinite,set:coreos"
+ os: coreos
+ role: controller
+ etcd_role: member
+
+ - name: "coreos-02"
+ ssh_ip: 10.0.2.15
+ mac: "08:00:27:66:95:9F"
+ dnsmasq_config:
+ - "08:00:27:66:95:9F,10.252.0.13,coreos-02,infinite,set:coreos"
+ - "08:00:27:66:95:8F,10.220.220.13,coreos-02,infinite,set:coreos"
+ os: coreos
+ role: worker
+ etcd_role: member
+
+ - name: "coreos-03"
+ ssh_ip: 10.0.2.15
+ mac: "08:00:27:66:95:A0"
+ dnsmasq_config:
+ - "08:00:27:66:95:A0,10.252.0.14,coreos-03,infinite,set:coreos"
+ - "08:00:27:66:95:A3,10.220.220.14,coreos-03,infinite,set:coreos"
+ os: coreos
+ role: worker
+ etcd_role: member
+
+ - name: "ceph-01"
+ ssh_ip: 10.0.2.15
+ dnsmasq_config:
+ - "08:00:27:66:95:A1,10.252.0.21,ceph-01,infinite"
+ os: centos
+ role: ""
+ etcd_role: ""
diff --git a/vagrant/pxe/single_node_config.yml b/vagrant/pxe/single_node_config.yml
new file mode 100755
index 0000000..17ff408
--- /dev/null
+++ b/vagrant/pxe/single_node_config.yml
@@ -0,0 +1,88 @@
+# -*- encoding: utf-8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/engagementmgr
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+boxen:
+ - name: ops-01
+ box: centos/7
+ ips: ['10.252.0.2', "10.220.220.2"]
+ macs: []
+ cpus: 1
+ cpu: "50"
+ memory: "1024"
+ groups: ["bootstrap", "centos",]
+ vagrant_ssh_port: 2502
+
+ - name: ceph-01
+ box: centos/7
+ ips: ["10.252.0.21", "10.220.220.21"]
+ cpus: 2
+ cpu: 50
+ memory: 1024
+ macs: ["0800276695A1","0800276695A2"]
+ groups: ["ceph", "osds", "mons", "rgws", "rbdhost", "centos"]
+ vagrant_ssh_port: 2521
+
+ - name: coreos-01
+ box: vvp-empty
+ cpus: 1
+ cpu: 50
+ memory: 4096
+ macs: ["08002766959E","08002766958E"]
+ ips: ["10.252.0.12", "10.220.220.12"]
+ groups: ["coreos", "container-hosts", "fleetctl-host"]
+ vagrant_ssh_port: 2512
+
+
+hosts:
+ - name: "coreos-01"
+ ssh_ip: 10.0.2.15
+ mac: "08:00:27:66:95:9E"
+ dnsmasq_config:
+ - "08:00:27:66:95:9E,10.252.0.12,coreos-01,infinite,set:coreos"
+ - "08:00:27:66:95:8E,10.220.220.12,coreos-01,infinite,set:coreos"
+ os: coreos
+ role: controller
+ etcd_role: member
+
+ - name: "ceph-01"
+ ssh_ip: 10.0.2.15
+ dnsmasq_config:
+ - "08:00:27:66:95:A1,10.252.0.21,ceph-01,infinite"
+ os: centos
+ role: ""
+ etcd_role: ""