-
Notifications
You must be signed in to change notification settings - Fork 33
Load boxes.yaml and allow vagrant-hostmanager to update hypervisor #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,12 @@ | ||||||||
| require 'yaml' | ||||||||
|
|
||||||||
| Vagrant.configure("2") do |config| | ||||||||
| if Vagrant.has_plugin?('vagrant-hostmanager') | ||||||||
| config.hostmanager.enabled = true | ||||||||
| config.hostmanager.manage_host = true | ||||||||
| config.hostmanager.manage_guest = true | ||||||||
| config.hostmanager.include_offline = true | ||||||||
| end | ||||||||
| config.vm.synced_folder ".", "/vagrant" | ||||||||
|
|
||||||||
| config.vm.provision("etc_hosts", type: 'ansible') do |ansible| | ||||||||
|
|
@@ -17,7 +25,7 @@ Vagrant.configure("2") do |config| | |||||||
| override.vm.provider "libvirt" do |libvirt, provider| | ||||||||
| libvirt.memory = 10240 | ||||||||
| libvirt.cpus = 4 | ||||||||
| libvirt.machine_virtual_size = 30 | ||||||||
| libvirt.machine_virtual_size = 50 | ||||||||
| end | ||||||||
| end | ||||||||
|
|
||||||||
|
|
@@ -38,4 +46,23 @@ Vagrant.configure("2") do |config| | |||||||
| libvirt.memory = 2048 | ||||||||
| end | ||||||||
| end | ||||||||
|
|
||||||||
| # Load user-local box definitions from boxes.yaml (gitignored) | ||||||||
| boxes_yaml = File.join(__dir__, 'boxes.yaml') | ||||||||
| if File.exist?(boxes_yaml) | ||||||||
| user_boxes = YAML.safe_load(File.read(boxes_yaml)) || {} | ||||||||
| user_boxes.each do |name, settings| | ||||||||
| next if settings.nil? | ||||||||
|
Comment on lines
+54
to
+55
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| config.vm.define name do |override| | ||||||||
| override.vm.box = ENV.fetch("FOREMANCTL_BASE_BOX", settings.fetch('box', 'centos/stream9')) | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the order be reversed and have the settings take priority?
Suggested change
|
||||||||
| override.vm.hostname = settings.fetch('hostname', "#{name}.example.com") | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once you rebase, please respect the Vagrant domain here. |
||||||||
|
|
||||||||
| override.vm.provider "libvirt" do |libvirt, _provider| | ||||||||
| libvirt.memory = settings.fetch('memory', 4096) | ||||||||
| libvirt.cpus = settings.fetch('cpus', 1) | ||||||||
| libvirt.machine_virtual_size = settings['disk_size'] if settings.key?('disk_size') | ||||||||
| end | ||||||||
| end | ||||||||
| end | ||||||||
| end | ||||||||
| end | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminds me we should clean up the gitignore as it has some forklift-isms.