lib/catfish/templates/Vagrantfile.tt in catfish-0.0.5 vs lib/catfish/templates/Vagrantfile.tt in catfish-0.0.6

- old
+ new

@@ -1,11 +1,10 @@ # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "tknerr/managed-server-dummy" <% if config[:provisioners].include? 'shell' -%> <% config[:shell_paths].each do |path| -%> config.vm.provision 'shell', path: '<%= path %>' <% end -%> <% end -%> @@ -19,22 +18,38 @@ <% end -%> end <% end -%> <% if config[:communicator] == 'winrm' -%> config.vm.communicator = '<%= config[:communicator] %>' - config.vm.winrm.username = '<%= config[:winrm_username] %>' - config.vm.winrm.password = '<%= config[:winrm_password] %>' <% end -%> - instances = File.readlines('Catfishfile.lock').map(&:chomp) - instances.each do |instance| - config.vm.define "#{instance}" do |box| - box.vm.provider :managed do |managed, override| - managed.server = instance +<% if config[:local] -%> + config.vm.define 'local' do |local| + local.vm.box = "<%= config[:local_box] %>" +<% if config[:local_box_url] -%> + local.vm.box_url = "<%= config[:local_box_url] %>" +<% end -%> + end +<% end -%> + +<% if config[:managed] -%> + if File.exist?('Catfishfile.lock') + instances = File.readlines('Catfishfile.lock').map(&:chomp) + instances.each do |instance| + config.vm.define "managed-#{instance}" do |box| + box.vm.box = "tknerr/managed-server-dummy" + box.vm.provider :managed do |managed, override| + managed.server = instance <% if config[:communicator] == 'ssh' -%> - override.ssh.username = '<%= config[:ssh_username] %>' - override.ssh.private_key_path = '<%= config[:ssh_private_key_path] %>' + override.ssh.username = '<%= config[:ssh_username] %>' + override.ssh.private_key_path = '<%= config[:ssh_private_key_path] %>' <% end -%> +<% if config[:communicator] == 'winrm' -%> + instance.vm.winrm.username = '<%= config[:winrm_username] %>' + instance.vm.winrm.password = '<%= config[:winrm_password] %>' +<% end -%> + end end end end +<% end -%> end