|
| 1 | +# -*- mode: ruby -*- |
| 2 | +# vi: set ft=ruby : |
| 3 | + |
| 4 | +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! |
| 5 | +VAGRANTFILE_API_VERSION = '2' |
| 6 | + |
| 7 | +Vagrant.require_version '>= 1.5.0' |
| 8 | + |
| 9 | +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
| 10 | + config.vm.box = ENV['LINUX_TEMPLATE_NAME'] |
| 11 | + |
| 12 | + config.vm.synced_folder ".", "/vagrant", type: "rsync", |
| 13 | + rsync__exclude: [".git/", "vendor"], disabled: true |
| 14 | + |
| 15 | + config.vm.provider :cloudstack do |cloudstack, override| |
| 16 | + cloudstack.display_name = ENV['TEST_NAME'] |
| 17 | + |
| 18 | + cloudstack.host = ENV['CLOUDSTACK_HOST'] |
| 19 | + # Use default path, port and scheme |
| 20 | + cloudstack.api_key = ENV['CLOUDSTACK_API_KEY'] |
| 21 | + cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY'] |
| 22 | + cloudstack.zone_name = ENV['ZONE_NAME'] |
| 23 | + cloudstack.network_name = ENV['NETWORK_NAME'] |
| 24 | + cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME'] |
| 25 | + cloudstack.ssh_key = ENV['SSH_KEY'] unless ENV['SSH_KEY'].nil? |
| 26 | + cloudstack.ssh_user = ENV['SSH_USER'] unless ENV['SSH_USER'].nil? |
| 27 | + |
| 28 | + cloudstack.pf_ip_address = ENV['PUBLIC_SOURCE_NAT_IP'] |
| 29 | + cloudstack.pf_public_port = ENV['PUBLIC_SSH_PORT'] |
| 30 | + cloudstack.pf_private_port = ENV['PRIVATE_SSH_PORT'] |
| 31 | + cloudstack.pf_open_firewall = false |
| 32 | + |
| 33 | + # With Advanced networking, following Basic networking features should be ignored |
| 34 | + cloudstack.security_groups = [{ |
| 35 | + :name => "Awesome_security_group", |
| 36 | + :description => "Created from the Vagrantfile", |
| 37 | + :rules => [{:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}] |
| 38 | + }] |
| 39 | + cloudstack.security_group_names = ['default', 'Awesome_security_group'] |
| 40 | + # With Advanced networking, following Basic networking features should be ignored |
| 41 | + |
| 42 | + cloudstack.pf_trusted_networks = [ ENV['SOURCE_CIDR'] ] |
| 43 | + cloudstack.firewall_rules = [ |
| 44 | + # Full Firewall rule |
| 45 | + { :ipaddress => cloudstack.pf_ip_address, :protocol => 'tcp', :startport => 1111, :endport => 1111 }, |
| 46 | + # Firewall rule without ':ipaddress' which defaults to 'cloudstack.pf_ip_address' |
| 47 | + { :protocol => 'tcp', :startport => 1122, :endport => 1122 }, |
| 48 | + # Firewall rule without ':protocol', which defaults to 'tcp' |
| 49 | + { :startport => 1133, :endport => 1133 }, |
| 50 | + # Firewall rule without ':endport', which defaults to ':startport' if present |
| 51 | + { :startport => 1144 }, |
| 52 | + # Firewall rule without ':start', which defaults to ':endport' if present |
| 53 | + { :endport => 22 } |
| 54 | + ] |
| 55 | + cloudstack.port_forwarding_rules = [ |
| 56 | + # Full portforwarding rule |
| 57 | + { :ipaddress => cloudstack.pf_ip_address, :protocol => "tcp", :publicport => 1111, :privateport => 22, :openfirewall => false }, |
| 58 | + # Portforwarding rule without ':ipaddress' which defaults to 'cloudstack.pf_ip_address' |
| 59 | + { :protocol => "tcp", :publicport => 1122, :privateport => 22, :openfirewall => false }, |
| 60 | + # Portforwarding rule without ':protocol', which defaults to 'tcp' |
| 61 | + { :publicport => 1133, :privateport => 22, :openfirewall => false }, |
| 62 | + # Portforwarding rule without ':openfirewall', which defaults to 'cloudstack.pf_open_firewall' |
| 63 | + { :publicport => 1144, :privateport => 22 }, |
| 64 | + # Portforwarding rule without ':publicport', which defaults to ':privateport' |
| 65 | + { :privateport => 22 }, |
| 66 | + # Portforwarding rule with ':generate_firewall', which generates an apropriate |
| 67 | + # Firewall rule based ':publicport' => ':startport', and other defaults |
| 68 | + { :publicport => 1155, :privateport => 22, :generate_firewall => true }, |
| 69 | + # Portforwarding rule which instructs CloudStack to create a Firewall rule |
| 70 | + { :publicport => 1166, :privateport => 22, :openfirewall => true }, |
| 71 | + ] |
| 72 | + end |
| 73 | +end |
0 commit comments