OLD | NEW |
1 require 'yaml' | 1 require 'yaml' |
2 | 2 |
3 VAGRANTFILE_API_VERSION = "2" | 3 VAGRANTFILE_API_VERSION = "2" |
4 REPOSITORY_DIR = File.dirname(__FILE__) | 4 REPOSITORY_DIR = File.dirname(__FILE__) |
5 DEPENDENCY_SCRIPT = File.join(REPOSITORY_DIR, "ensure_dependencies.py") | 5 DEPENDENCY_SCRIPT = File.join(REPOSITORY_DIR, "ensure_dependencies.py") |
6 | 6 |
7 if !system("python", DEPENDENCY_SCRIPT) | 7 if !system("python", DEPENDENCY_SCRIPT) |
8 error = Vagrant::Errors::VagrantError | 8 error = Vagrant::Errors::VagrantError |
9 error.error_message("Failed to ensure dependencies being up-to-date!") | 9 error.error_message("Failed to ensure dependencies being up-to-date!") |
10 raise error | 10 raise error |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 puppet.module_path = 'modules' | 56 puppet.module_path = 'modules' |
57 end | 57 end |
58 | 58 |
59 yield(config) if block_given? | 59 yield(config) if block_given? |
60 end | 60 end |
61 end | 61 end |
62 | 62 |
63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") | 64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") |
65 config_data = YAML.load_file(config_path) | 65 config_data = YAML.load_file(config_path) |
66 servers = config_data["servers"] | 66 servers = config_data["adblockplus::hosts"] |
67 servers.each do |server, items| | 67 servers.each do |server, items| |
68 ip = items["ip"][0] | 68 next if items['ensure'] == 'absent' |
| 69 ip = items["ips"][0] |
69 role = items.fetch("role", "default") | 70 role = items.fetch("role", "default") |
70 define_standard_vm(config, server, ip, role) | 71 define_standard_vm(config, server, ip, role) |
71 end | 72 end |
72 end | 73 end |
OLD | NEW |