From 216d38b5a3e7c7454d55d86a820dcf62ebd313fc Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 30 Jun 2015 23:03:12 -0500 Subject: [PATCH] Fixes #136: Add unique Drupal VM machine name identifier. --- Vagrantfile | 2 +- example.config.yml | 7 +++++-- provisioning/tasks/drush-aliases.yml | 6 ++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 3498b5700..e4529f9d8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -85,6 +85,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end # Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134 - config.vm.define :drupaldev do |drupaldev_config| + config.vm.define vconfig['vagrant_machine_name'] do |d| end end diff --git a/example.config.yml b/example.config.yml index 4a5d006b8..29a1d5640 100644 --- a/example.config.yml +++ b/example.config.yml @@ -1,11 +1,14 @@ --- -# Vagrant configuration. # `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7, # geerlingguy/ubuntu1204, parallels/ubuntu-14.04, etc. vagrant_box: geerlingguy/ubuntu1404 +vagrant_user: vagrant + +# If you need to run multiple instances of Drupal VM, set a unique hostname, +# machine name, and IP address for each instance. vagrant_hostname: drupalvm.dev +vagrant_machine_name: drupalvm vagrant_ip: 192.168.88.88 -vagrant_user: vagrant # A list of synced folders, with the keys 'local_path', 'destination', 'id', and # a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See diff --git a/provisioning/tasks/drush-aliases.yml b/provisioning/tasks/drush-aliases.yml index 3d53282c6..832e5fc05 100644 --- a/provisioning/tasks/drush-aliases.yml +++ b/provisioning/tasks/drush-aliases.yml @@ -15,13 +15,11 @@ sudo: no when: configure_local_drush_aliases and (local_drush_config_folder.stat.exists == false) -# Two notes: -# 1. Doesn't work for Windows, since Ansible's running in the VM. -# 2. The most-recently-provisioned Drupal VM instance will control this file. +# Note that this doesn't work for Windows, since Ansible's running in the VM. - name: Configure host machine drush aliases. template: src: ../templates/drupalvm.aliases.drushrc.php.j2 - dest: ~/.drush/drupalvm.aliases.drushrc.php + dest: "~/.drush/{{ vagrant_machine_name }}.aliases.drushrc.php" delegate_to: 127.0.0.1 sudo: no when: configure_local_drush_aliases