| LEFT | RIGHT |
| 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 24 matching lines...) Expand all Loading... |
| 35 # The repository location in the production system's puppet master | 35 # The repository location in the production system's puppet master |
| 36 if system('which', 'rsync', :out => File::NULL) | 36 if system('which', 'rsync', :out => File::NULL) |
| 37 config.vm.synced_folder ".", "/etc/puppet/infrastructure", type: "rsync" | 37 config.vm.synced_folder ".", "/etc/puppet/infrastructure", type: "rsync" |
| 38 else | 38 else |
| 39 config.vm.synced_folder ".", "/etc/puppet/infrastructure" | 39 config.vm.synced_folder ".", "/etc/puppet/infrastructure" |
| 40 end | 40 end |
| 41 | 41 |
| 42 config.vm.provision :shell, :inline => ' | 42 config.vm.provision :shell, :inline => ' |
| 43 sudo /etc/puppet/infrastructure/hiera/install_precise.py | 43 sudo /etc/puppet/infrastructure/hiera/install_precise.py |
| 44 ' | 44 ' |
| 45 | |
| 46 config.vm.provision :puppet do |puppet| | 45 config.vm.provision :puppet do |puppet| |
| 47 puppet.options = [ | 46 puppet.options = [ |
| 48 '--environment=development', | 47 '--environment=development', |
| 49 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie
r.rb', | 48 '--external_nodes=/etc/puppet/infrastructure/hiera/puppet_node_classifie
r.rb', |
| 50 '--node_terminus=exec', | 49 '--node_terminus=exec', |
| 51 '--verbose', | 50 '--verbose', |
| 52 '--debug', | 51 '--debug', |
| 53 ] | 52 ] |
| 54 puppet.manifests_path = 'manifests' | 53 puppet.manifests_path = 'manifests' |
| 55 puppet.manifest_file = 'nodes.pp' | 54 puppet.manifest_file = 'nodes.pp' |
| 56 puppet.module_path = 'modules' | 55 puppet.module_path = 'modules' |
| 57 end | 56 end |
| 58 | 57 |
| 59 yield(config) if block_given? | 58 yield(config) if block_given? |
| 60 end | 59 end |
| 61 end | 60 end |
| 62 | 61 |
| 63 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 62 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
| 64 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") | 63 config_path = File.join(REPOSITORY_DIR, "modules/private/hiera/hosts.yaml") |
| 65 config_data = YAML.load_file(config_path) | 64 config_data = YAML.load_file(config_path) |
| 66 servers = config_data["servers"] | 65 servers = config_data["servers"] |
| 67 servers.each do |server, items| | 66 servers.each do |server, items| |
| 68 ip = items["ip"][0] | 67 ip = items["ip"][0] |
| 69 role = items.fetch("role", "default") | 68 role = items.fetch("role", "default") |
| 70 define_standard_vm(config, server, ip, role) | 69 define_standard_vm(config, server, ip, role) |
| 71 end | 70 end |
| 72 end | 71 end |
| LEFT | RIGHT |