Skip to content

Commit f90b820

Browse files
committed
Fixes geerlingguy#41: Set up Drupal in a synced folder for easier development.
1 parent ed8103b commit f90b820

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ Note for Windows users: *Ansible will be installed inside the VM, and everything
4848
2. Make copies of both of the `example.*` files, and modify to your liking:
4949
- Copy `example.drupal.make.yml` to `drupal.make.yml`.
5050
- Copy `example.config.yml` to `config.yml`.
51-
3. Install Ansible Galaxy roles required for this VM: `$ sudo ansible-galaxy install -r requirements.txt`
52-
4. Open Terminal, cd to this directory (containing the `Vagrantfile` and this README file).
53-
5. Type in `vagrant up`, and let Vagrant do its magic.
51+
3. Create a local directory where Drupal will be installed (so you can work with the files locally or within the VM), and configure the path to that directory in `config.yml`.
52+
4. Install Ansible Galaxy roles required for this VM: `$ sudo ansible-galaxy install -r requirements.txt`
53+
5. Open Terminal, cd to this directory (containing the `Vagrantfile` and this README file).
54+
6. Type in `vagrant up`, and let Vagrant do its magic.
5455

5556
Note: *If there are any errors during the course of running `vagrant up`, and it drops you back to your command prompt, just run `vagrant provision` to continue building the VM from where you left off. If there are still errors after doing this a few times, post an issue to this project's issue queue on GitHub with the error.*
5657

@@ -134,6 +135,7 @@ If you'd like to use the included configuration and Drush make file to install a
134135
## Other Notes
135136

136137
- To shut down the virtual machine, enter `vagrant halt` in the Terminal in the same folder that has the `Vagrantfile`. To destroy it completely (if you want to save a little disk space, or want to rebuild it from scratch with `vagrant up` again), type in `vagrant destroy`.
138+
- When you rebuild the VM (e.g. `vagrant destroy` and then another `vagrant up`), make sure you clear out the contents of the `drupal` folder on your host machine, or Drupal will return some errors when the VM is rebuilt (it won't reinstall Drupal cleanly).
137139
- You can change the installed version of Drupal or drush, or any other configuration options, by editing the variables within `vars/main.yml`.
138140
- Find out more about local development with Vagrant + VirtualBox + Ansible in this presentation: [Local Development Environments - Vagrant, VirtualBox and Ansible](http://www.slideshare.net/geerlingguy/local-development-on-virtual-machines-vagrant-virtualbox-and-ansible).
139141
- Learn about how Ansible can accelerate your ability to innovate and manage your infrastructure by reading [Ansible for DevOps](https://leanpub.com/ansible-for-devops).

example.config.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ vagrant_hostname: drupaltest.dev
44
vagrant_ip: 192.168.88.88
55
vagrant_user: vagrant
66

7-
# A list of synced folders, with the keys 'local_path', 'destination', and 'id'.
7+
# A list of synced folders, with the keys 'local_path', 'destination', 'id', and
8+
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares).
89
vagrant_synced_folders:
9-
- local_path: ~/Sites/drupal
10-
destination: /drupal
11-
excluded_paths: [".git/"]
10+
# This first folder will be used for the default Drupal installation.
11+
- local_path: ~/Sites/vagrant
12+
destination: /var/www
1213
id: drupal
13-
type: rsync
14+
type: nfs
1415

1516
# Memory and CPU to use for this VM.
1617
vagrant_memory: 1024

provisioning/tasks/drupal.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
notify: restart webserver
1010

1111
- name: Check if Drupal is already set up.
12-
stat: "path={{ drupal_core_path }}"
12+
stat: "path={{ drupal_core_path }}/index.php"
1313
register: drupal_site
1414

1515
- name: Generate Drupal site with drush makefile.
@@ -52,11 +52,3 @@
5252
dest: "{{ drupal_custom_modules_path }}"
5353
state: link
5454
sudo: no
55-
56-
- name: Update ownership of all files within drupal_core_path.
57-
file:
58-
path: "{{ drupal_core_path }}"
59-
owner: "{{ vagrant_user }}"
60-
group: www-data
61-
mode: 0775
62-
recurse: yes

provisioning/tasks/www.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,3 @@
77

88
- name: Ensure vagrant user is in admin group.
99
user: "name={{ vagrant_user }} append=yes groups=admin"
10-
11-
- name: Set permissions on /var/www.
12-
file:
13-
path: /var/www
14-
state: directory
15-
owner: "{{ vagrant_user }}"
16-
group: admin
17-
mode: 0775
18-
recurse: yes

0 commit comments

Comments
 (0)