Vagrantfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. VAGRANTFILE_API_VERSION = "2"
  4. unless Vagrant.has_plugin?("vagrant-hostmanager")
  5. raise 'vagrant-hostmanager plugin is required'
  6. end
  7. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  8. deployment_type = ENV['OPENSHIFT_DEPLOYMENT_TYPE'] || 'origin'
  9. num_nodes = (ENV['OPENSHIFT_NUM_NODES'] || 2).to_i
  10. config.hostmanager.enabled = true
  11. config.hostmanager.manage_host = true
  12. config.hostmanager.include_offline = true
  13. config.ssh.insert_key = false
  14. config.vm.provider "virtualbox" do |vbox, override|
  15. override.vm.box = "chef/centos-7.1"
  16. vbox.memory = 1024
  17. vbox.cpus = 2
  18. # Enable multiple guest CPUs if available
  19. vbox.customize ["modifyvm", :id, "--ioapic", "on"]
  20. end
  21. config.vm.provider "libvirt" do |libvirt, override|
  22. libvirt.cpus = 2
  23. libvirt.memory = 1024
  24. libvirt.driver = 'kvm'
  25. override.vm.box = "centos-7.1"
  26. override.vm.box_url = "https://download.gluster.org/pub/gluster/purpleidea/vagrant/centos-7.1/centos-7.1.box"
  27. override.vm.box_download_checksum = "b2a9f7421e04e73a5acad6fbaf4e9aba78b5aeabf4230eebacc9942e577c1e05"
  28. override.vm.box_download_checksum_type = "sha256"
  29. end
  30. num_nodes.times do |n|
  31. node_index = n+1
  32. config.vm.define "node#{node_index}" do |node|
  33. node.vm.hostname = "ose3-node#{node_index}.example.com"
  34. node.vm.network :private_network, ip: "192.168.100.#{200 + n}"
  35. end
  36. end
  37. config.vm.define "master" do |master|
  38. master.vm.hostname = "ose3-master.example.com"
  39. master.vm.network :private_network, ip: "192.168.100.100"
  40. master.vm.network :forwarded_port, guest: 8443, host: 8443
  41. master.vm.provision "ansible" do |ansible|
  42. ansible.limit = 'all'
  43. ansible.sudo = true
  44. ansible.groups = {
  45. "masters" => ["master"],
  46. "nodes" => ["node1", "node2"],
  47. }
  48. ansible.extra_vars = {
  49. openshift_deployment_type: "origin",
  50. }
  51. ansible.playbook = "playbooks/byo/config.yml"
  52. end
  53. end
  54. end