diff --git a/scripts/drupal-vm/config.yml b/scripts/drupal-vm/config.yml index 224ae7ba82..625f482807 100644 --- a/scripts/drupal-vm/config.yml +++ b/scripts/drupal-vm/config.yml @@ -3,7 +3,7 @@ vagrant_hostname: ${project.local.hostname} vagrant_machine_name: ${project.machine_name} # Set the IP address so it doesn't conflict with other Drupal VM instances. -vagrant_ip: 192.168.25.8 +vagrant_ip: ${random.ip} # Use Ubuntu 14.04 LTS to more closely match Acquia Cloud environment. vagrant_box: geerlingguy/ubuntu1404 diff --git a/src/Robo/Commands/Vm/VmCommand.php b/src/Robo/Commands/Vm/VmCommand.php index 84a81d2cb6..f2339708f6 100644 --- a/src/Robo/Commands/Vm/VmCommand.php +++ b/src/Robo/Commands/Vm/VmCommand.php @@ -139,7 +139,12 @@ public function config() { ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->run(); - $this->getConfig()->expandFileProperties($this->projectDrupalVmConfigFile); + // Generate a Random IP address for the new VM. + $config = clone $this->getConfig(); + $random_local_ip = "192.168." . rand(0, 255) . '.' . rand(0, 255); + $config->set('random.ip', $random_local_ip); + + $config->expandFileProperties($this->projectDrupalVmConfigFile); $vm_config = Yaml::parse(file_get_contents($this->projectDrupalVmConfigFile)); $this->validateConfig($vm_config);