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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 config.vm.provision :puppet do |puppet| | 42 config.vm.provision :puppet do |puppet| |
43 puppet.options = [ | 43 puppet.options = [ |
44 '--environment=development', | 44 '--environment=development', |
45 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie
r.rb', | 45 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie
r.rb', |
46 '--node_terminus=exec', | 46 '--node_terminus=exec', |
47 '--verbose', | 47 '--verbose', |
48 '--debug', | 48 '--debug', |
49 ] | 49 ] |
50 puppet.manifests_path = 'manifests' | 50 puppet.manifests_path = 'manifests' |
51 puppet.manifest_file = 'nodes.pp' | 51 puppet.manifest_file = 'site.pp' |
52 puppet.module_path = 'modules' | 52 puppet.module_path = 'modules' |
53 end | 53 end |
54 | 54 |
55 yield(config) if block_given? | 55 yield(config) if block_given? |
56 end | 56 end |
57 end | 57 end |
58 | 58 |
59 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 59 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
60 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") | 60 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") |
61 config_data = YAML.load_file(config_path) | 61 config_data = YAML.load_file(config_path) |
62 servers = config_data["servers"] | 62 servers = config_data["servers"] |
63 servers.each do |server, items| | 63 servers.each do |server, items| |
64 ip = items["ip"][0] | 64 ip = items["ip"][0] |
65 role = items.fetch("role", "default") | 65 role = items.fetch("role", "default") |
66 define_standard_vm(config, server, ip, role) | 66 define_standard_vm(config, server, ip, role) |
67 end | 67 end |
68 end | 68 end |
OLD | NEW |