# Bedrock Vagrant/Ansible released

**URL:** https://discourse.roots.io/t/bedrock-vagrant-ansible-released/1555
**Category:** bedrock
**Created:** 2014-04-16T19:26:28Z
**Posts:** 58

## Post 1 by @swalkinshaw — 2014-04-16T19:26:28Z

The last planned part of Bedrock was Vagrant/Ansible integration. We’ve finally released it here [https://github.com/roots/bedrock-ansible](https://github.com/roots/bedrock-ansible)

This is an Ansible playbook which will setup a LEMP based Ubuntu server for Bedrock based WordPress sites. It’s still early in development but we want people to try it out and give suggestions and feedback.

Check out the README for more information, but this thread can be the dedicated place for discussion and help.

---

## Post 3 by @intelligence — 2014-04-19T07:12:43Z

Looking forward to trying this out with my next project!

---

## Post 5 by @swalkinshaw — 2014-04-22T03:12:33Z

It’s possible and intended. That’s why this playbook exists: to provision a (Ubuntu for now) server from nothing. It could happen to be for development, staging, or production.

bedrock-ansible is currently lacking some finesse when it comes to managing production servers. One of the easiest ways is to use Vagrant for dev and prov. I’ll add an example `Vagrantfile` soon with multi VMs defined (using the Digital Ocean plugin).

Ideally, Ansible itself would probably be used to launch and provision production servers. There’s nothing stopping you from doing this now, we just haven’t built anything in or providing docs/examples of it.

The way I’ve been using it right now is:

- dev: Vagrant does everything and uses a synced folder
- prod: Vagrant provisions server (to DO for example) and then you use Capistrano for deploys

---

## Post 6 by @Jaace — 2014-04-24T14:51:37Z

Trying this currently - I’ll report back with any issues!

One thing I’m curious about, what’s the reasoning behind using ubuntu/trusty64? I’ve been using Ubuntu 12.04.3 x32 this whole time, just wondering if Trusty64 was better for a Vagrant LEMPstack WordPress setup for some reason or if it’s just preference.

---

## Post 7 by @Foxaii — 2014-04-24T15:08:51Z

I haven’t got round to conducting any significant performance tests, so it’s more of a preference than anything. 32 bit will probably be quicker thanks to the memory overheads.

One of the reasons the PPAs were kept in tact was to allow the base box to be easily changed, so feel free to test and report back.

---

## Post 8 by @Jaace — 2014-04-24T15:35:52Z

Tried to install twice and I’m getting the following issue both times. It seems like it’s unable to install WordPress – was I supposed to have a WordPress install all ready to go or is this supposed to automatically set up WordPress? It seems like it should but I’m not sure if I’m doing something incorrectly. It’s hard to tell from the errors (sorry for the wall of code, just want to give the full output where the errors start):

**Cropped stuff before this**

```
TASK: [wordpress-sites | Add WP user to www-data group] ***********************
changed: [default] => (item={'site_install': True, 'admin_user': 'user', 'site_name': 'bansible.dev', 'system_cron': True, 'user': 'vagrant', 'multisite': {'enabled': False}, 'group': 'www-data', 'site_title': 'Bedrock Ansible Test', 'admin_password': 'password', 'env': {'wp_env': 'development', 'db_user': 'bansible_admin', 'db_password': 'root', 'wp_siteurl': 'http://bansible.dev/wp', 'db_name': 'bansible_dev', 'wp_home': 'http://bansible.dev'}, 'site_hosts': ['192.168.50.5', 'bansible.dev'], 'admin_email': 'jb5531@gmail.com'})

TASK: [wordpress-sites | WP installed?] ***************************************
failed: [default] => (item={'site_install': True, 'admin_user': 'user', 'site_name': 'bansible.dev', 'system_cron': True, 'user': 'vagrant', 'multisite': {'enabled': False}, 'group': 'www-data', 'site_title': 'Bedrock Ansible Test', 'admin_password': 'password', 'env': {'wp_env': 'development', 'db_user': 'bansible_admin', 'db_password': 'root', 'wp_siteurl': 'http://bansible.dev/wp', 'db_name': 'bansible_dev', 'wp_home': 'http://bansible.dev'}, 'site_hosts': ['192.168.50.5', 'bansible.dev'], 'admin_email': 'jb5531@gmail.com'}) => {"changed": true, "cmd": ["wp", "core", "is-installed", "--allow-root"], "delta": "0:00:00.248335", "end": "2014-04-24 15:24:39.742968", "item": {"admin_email": "jb5531@gmail.com", "admin_password": "password", "admin_user": "user", "env": {"db_name": "bansible_dev", "db_password": "root", "db_user": "bansible_admin", "wp_env": "development", "wp_home": "http://bansible.dev", "wp_siteurl": "http://bansible.dev/wp"}, "group": "www-data", "multisite": {"enabled": false}, "site_hosts": ["192.168.50.5", "bansible.dev"], "site_install": true, "site_name": "bansible.dev", "site_title": "Bedrock Ansible Test", "system_cron": true, "user": "vagrant"}, "rc": 1, "start": "2014-04-24 15:24:39.494633"}
stderr: Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.
...ignoring

TASK: [wordpress-sites | Install WP] ******************************************
failed: [default] => (item={'item': {'site_install': True, 'admin_user': 'user', 'site_name': 'bansible.dev', 'system_cron': True, 'user': 'vagrant', 'multisite': {'enabled': False}, 'group': 'www-data', 'site_title': 'Bedrock Ansible Test', 'admin_password': 'password', 'env': {'wp_env': 'development', 'db_user': 'bansible_admin', 'db_password': 'root', 'wp_siteurl': 'http://bansible.dev/wp', 'db_name': 'bansible_dev', 'wp_home': 'http://bansible.dev'}, 'site_hosts': ['192.168.50.5', 'bansible.dev'], 'admin_email': 'jb5531@gmail.com'}, u'delta': u'0:00:00.248335', u'cmd': [u'wp', u'core', u'is-installed', u'--allow-root'], u'end': u'2014-04-24 15:24:39.742968', u'stderr': u'Error: This does not seem to be a WordPress install.\nPass --path=`path/to/wordpress` or run `wp core download`.', u'stdout': '', 'invocation': {'module_name': 'command', 'module_args': u'wp core is-installed --allow-root chdir=/srv/www/bansible.dev/current/'}, u'changed': True, u'rc': 1, u'start': u'2014-04-24 15:24:39.494633'}) => {"changed": true, "cmd": ["wp", "core", "install", "--allow-root", "--url=http://bansible.dev", "--title=Bedrock Ansible Test", "--admin_user=user", "--admin_password=password", "--admin_email=jb5531@gmail.com"], "delta": "0:00:00.217433", "end": "2014-04-24 15:24:40.412951", "item": {"changed": true, "cmd": ["wp", "core", "is-installed", "--allow-root"], "delta": "0:00:00.248335", "end": "2014-04-24 15:24:39.742968", "invocation": {"module_args": "wp core is-installed --allow-root chdir=/srv/www/bansible.dev/current/", "module_name": "command"}, "item": {"admin_email": "jb5531@gmail.com", "admin_password": "password", "admin_user": "user", "env": {"db_name": "bansible_dev", "db_password": "root", "db_user": "bansible_admin", "wp_env": "development", "wp_home": "http://bansible.dev", "wp_siteurl": "http://bansible.dev/wp"}, "group": "www-data", "multisite": {"enabled": false}, "site_hosts": ["192.168.50.5", "bansible.dev"], "site_install": true, "site_name": "bansible.dev", "site_title": "Bedrock Ansible Test", "system_cron": true, "user": "vagrant"}, "rc": 1, "start": "2014-04-24 15:24:39.494633", "stderr": "Error: This does not seem to be a WordPress install.\nPass --path=`path/to/wordpress` or run `wp core download`.", "stdout": ""}, "rc": 1, "start": "2014-04-24 15:24:40.195518"}
stderr: Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/Jason/site.retry

default : ok=45 changed=32 unreachable=0 failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
```

---

## Post 9 by @swalkinshaw — 2014-04-24T15:36:17Z

Reasons to use x64:

1. It’s generally faster
2. It’s recommended by Ubuntu now
3. Might as well start with 64bit in case you ever need more than 3/4GB RAM.
4. There’s no reason not to use it?
5. It’s 2014 :smile:

[http://howtoubuntu.org/how-to-decide-if-you-should-use-32bit-or-64bit-ubuntu](http://howtoubuntu.org/how-to-decide-if-you-should-use-32bit-or-64bit-ubuntu)

---

## Post 10 by @swalkinshaw — 2014-04-24T15:38:01Z

I think you’re the 3rd person to get confused by this so I should probably improve the `README`. See both these issues for the solution:

> <https://github.com/roots/trellis/issues/1>
>
> I'm experimenting with bedrock-ansible and I'm getting the following error. Seems it's not properly downloading Wordpress when it detects that it...

  

> <https://github.com/roots/trellis/issues/2>
>
> Hi there,
> Thank you for all your hard work on this and roots in general. I really appreciate it and the approach...

---

## Post 11 by @Jaace — 2014-04-24T19:17:53Z

Great! I’ll check that out. So the idea is to use Composer to load Bedrock in the local environment as opposed to running Composer on the Vagrant machine through “vagrant ssh”… is that correct?

---

## Post 12 by @swalkinshaw — 2014-04-24T19:32:17Z

Actually… Bedrock encourages people to use `composer create-project` but part of the benefit of having a nice dev environment in a VM is to not worry about installing some newer PHP version or Composer. So ideally, you wouldn’t even install Composer on your local OS. You’d just `git clone` Bedrock/a fork or download a ZIP of it. Then use the Ansible playbooks for the VM which will install Composer on there.

The playbook also generates your `.env` file too so you don’t need that part of `composer create-project`.

This is another thing that I’ll have to clear up at some point in the docs of both projects.

---

## Post 13 by @Jaace — 2014-04-24T23:01:35Z

I guess I’m confused and I’ll just have to wait until I see some examples.

How I’m understanding this is that Bedrock needs to (or rather, should) use Composer to install WordPress and Bedrock Vagrant/Ansible needs Wordpress already installed to complete the setup for the VM properly…

I’m trying to figure out how to start up a fresh project using this and I’m stuck.

---

## Post 14 by @swalkinshaw — 2014-04-25T01:48:02Z

No wonder you’re confused and it’s my fault! I completely forgot that of course you’d have to use Composer to “install” WP in a local Bedrock project in order for the Ansible playbook to work correctly.

So yeah, for now you still Composer locally and to run `composer install` first.

What I’ll probably do is add the ability for Ansible to run `composer install` itself to make it easier.

Here are the steps you’d need right now:

1. Download/clone/run `composer create-project` to create a new Bedrock based project. Don’t generate `.env` if you use Composer.

2. Run `composer install` if you didn’t use `composer create-project`.

3. Download/clone bedrock-ansible. Either copy `Vagrantfile`into the directory created in #1 or keep it anywhere you want, but make sure to adjust the relative paths and the synced folder.

4. Setup/edit `group_vars`

5. Run `vagrant up` or just `vagrant provision` if you already ran up.

---

## Post 15 by @Jaace — 2014-04-25T02:41:45Z

Awesome! I got it to install correctly – the only thing is that I needed to change system\_cron to false in the group\_vars/all file. It was true originally. Not sure the implications that will have.

---

## Post 16 by @swalkinshaw — 2014-04-25T03:08:49Z

Did that actually cause an error? `system_cron: true` just sets up a manual cron job on the server instead of using WP’s internal cron. This is needed since by default Bedrock has `DISABLE_WP_CRON` set to `true`.

Let us know if you have any suggestions about all this Ansible stuff. It’s hard to anticipate other people’s workflows when it’s only you using it.

---

## Post 17 by @Jaace — 2014-04-25T13:39:57Z

The error caused when I had system\_cron set to true:

```
TASK: [wordpress-sites | Setup system cron] ***********************************
fatal: [default] => One or more undefined variables: 'dict object' has no attribute 'item'

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/Jason/site.retry

default : ok=47 changed=34 unreachable=1 failed=0

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
```

When this happened, I couldn’t load the site at all, so changing system\_cron to false allowed it to finish setup. I can now go to the URL and have WordPress load but I haven’t done anything beyond that. Looking into it more this morning.

Bedrock/Ansible seems like it’s on the right track so far. Prior to this I was using [puPHPet](https://puphpet.com/) to set up a vagrant/puppet manifest that I’d then `vagrant ssh` into to use `composer create-project` for Bedrock. I’d use Composer to maintain the system on the VM side. I’d set up a new machine entirely for each project.

With Bedrock/Ansible it seems like the better way is to have one VM and just modify the group\_vars/all and Vagrantfile (or put the Vagrant file in each project directory specifically) for multiple projects… is that correct?

I’m still pretty new at using Vagrant and the benefit of it always seemed to be able to destroy the VM for a project and just create a new one…but after trying it that way it seems like one VM for multiple is the more efficient route.

I’ll be tinkering around a bit but I hope to have some suggestions soon. Thanks for all of your help and taking the time to build this!

---

## Post 18 by @swalkinshaw — 2014-04-25T14:20:52Z

Thanks for that debugging. I just pushed a commit to fix it.

Multiple sites on a VM vs a VM per site is the main thing people always ask about. We made these Ansible playbooks flexible with either in mind.

It depends purely on a person’s workflow though. If you’re working within a company on an internal WP app (or two), it makes sense to keep the VM per project and have the `Vagrantfile` tied to each project (in their repos).

If you’re a WP dev doing lots of client work and working on a new site every few weeks (or even more often), it makes more sense to keep 1 main VM with all your dev sites on it. So you’d probably just keep the `Vagrantfile` where it is by default in the ansible project dir.

---

## Post 19 by @Jaace — 2014-04-25T15:04:58Z

Just tried running it again with the new changes (verified they are indeed there) and I get the same error.

So I went into the file you changed and made one more change to line 65:

```
user={{ item.item.user }}
```

to

```
user={{ item.user }}
```

and that seemed to fix it. I’m not entirely sure what I’m doing but it just seems like you missed that line and it was trying to reference something that it couldn’t get to, which should be the vagrant user. Is that correct?

Now I’m getting other issues, like trying to go to my site “testproject.dev” yields the default “Welcome to nginx” screen and when I try to go to testpoject.dev/wp/wp-admin a 404 error.

EDIT: That error with the 404 / default nginx page was with `vagrant provision`. Trying again now with a destroy and then a fresh up.

---

## Post 20 by @swalkinshaw — 2014-04-25T15:41:58Z

Serves me right for using the GitHub editor… just fixed that again, thanks.

Getting the Nginx default page is usually solved by restarting the php-fpm server (`sudo service php5-fpm restart)`

---

## Post 21 by @Jaace — 2014-04-25T15:43:26Z

Doing a fresh vagrant up with the line 65 change I mentioned above does seem to work. The WordPress site loads almost perfectly (see below): no more nginx default screen / 404 screen.

I’m getting the following issues now:

- When going through the WordPress admin I’m getting a few errors on the Dashboard ![](https://discourse.roots.io/uploads/default/56/fea3c365ce9bf534.png)

- The default plugins (akismet, hello dolly) that come with WordPress aren’t on the plugins page, not sure if that has to do with the errors above, but I have a suspicion it may.

- When doing a `vagrant halt` and then starting up the machine again with `vagrant up`, my testproject.dev URL yeilds the nginx default screen and going to testproject.dev/wp or testproject.dev/wp/wp-admin yeilds a 502 Bad Gateway error. Maybe this is reserved to a VM problem on my end. I get a lot of “default: Warning Connction Timeout. Retrying…” followed by lines of “default: Warning: Remote connection disconnect. Retrying…” when starting up my machine. This varies all the time. Sometimes it times out entirely , other times it makes it through.

EDIT: Just saw your above response. Tried `sudo service php5-fpm restart` and also `sudo service nginx restart`. Still getting the 502 bad gateway. Now it’s not even showing the default nginx screen.  
Probably my VM… I gotta look into this.

---

## Post 22 by @intelligence — 2014-04-25T20:31:09Z

> [@swalkinshaw](#):
>
> If you’re a WP dev doing lots of client work and working on a new site every few weeks (or even more often), it makes more sense to keep 1 main VM with all your dev sites on it. So you’d probably just keep the Vagrantfile where it is by default in the ansible project dir.

Why’s that? I’ve only used Vagrant + Bedrock for one project so far, but to me I’d really feel that I’d want a separate VM for each project. I usually work one project at a time, and when I’m done I archive the project. With the Vagrant route I figure I just keep it all in the repo and if I ever need to work on it again (I seldom do actually), I’d just pull down the repo and be good to go.

Just curious why you would think otherwise :slight_smile:

---

## Post 23 by @swalkinshaw — 2014-04-25T21:19:24Z

Yeah, in that case, it makes sense to keep them on separate VMs since you archive them/finish work. What I said was mostly going on what others had wanted. Starting new VMs all the time takes longer and also takes up a lot more space. But really, once you’ve created them `vagrant up` is fast and ~700MB per site extra isn’t really that much in 2014.

---

## Post 24 by @Jaace — 2014-04-27T02:42:34Z

@swalkinshaw – would you mind telling me what version of Vagrant, VirtualBox you’re using and if you’re using the vbguest vagrant plugin? I’m not able to get mine working and I’m using:  
Vagrant 1.5.4  
VirtualBox 4.3.10 r93012  
I have the following vagrant plugins installed  
vagrant-login (1.0.1, system)  
vagrant-share (1.0.1, system)  
vagrant-vbguest (0.10.0)

I keep getting weird errors:

```
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant
```

I already looked up the fixes online but none are working for me, so I’m curious as to how you’re setup is and what versions you’re using. Thanks!

---

## Post 25 by @swalkinshaw — 2014-04-27T22:52:08Z

VirtualBox 4.3.2 r90405  
Vagrant 1.5.1  
vagrant-aws (0.4.1)  
vagrant-cachier (0.7.0)  
vagrant-login (1.0.1, system)  
vagrant-omnibus (1.3.1)  
vagrant-share (1.0.1, system)  
vagrant-vbguest (0.10.0)

You can disregard aws, cachier, and omnibus though. I’ve gotten that error before but used vbguest to fix it.

---

## Post 26 by @callerc1 — 2014-04-29T11:44:12Z

Hello, I have hit the same issue. “502 bad gateway” after a `vagrant halt` and `vagrant up`. Have also tried restarting both `php5-fpm` and `nginx` but no luck. Did you find a solution?

---

## Post 27 by @Jaace — 2014-04-29T14:09:42Z

@callerc1

Nope - I actually stopped working on getting this specific framework up and running, will be continuing on it today.

In the process of trying to figure out what was wrong, I downgraded Vagrant, Virtual Box and messed with the vb-guest plugin and just Guest Additions downloaded from the VirtualBox site. I ended up totally breaking my environment for my current workflow using puPHPet. As of last night, I think I’ve fixed it. Doing a few more tests and then back to Bedrock/Ansible.

I don’t know why it goes 502 bad gateway on a reload (halt and up) and also has a bunch of WordPress errors when you go to the Dashboard. I’ll let you know if I figure something out.

Since I’m using this alongside my working puPHPet setup, I’ll need to stick with these versions of everything, here’s what I’m using:

- VirtualBox 4.3.10 r93012
- Vagrant 1.5.4
- vagrant-login (1.0.1, system)
- vagrant-share (1.0.1, system)  
_I might install vagrant-vbguest but this was a suspect in messing up my other setup, need to investigate_
- ansible 1.5.5
- Guest Additions downloaded from  
[http://download.virtualbox.org/virtualbox/4.3.10/VBoxGuestAdditions\_4.3.10.iso](http://download.virtualbox.org/virtualbox/4.3.10/VBoxGuestAdditions_4.3.10.iso)  
and then copied to replace the Guest Additions in the VirtualBox  
applications folder.

`sudo cp ~/Downloads/VBoxGuestAdditions_4.3.10.iso /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso`

---

## Post 28 by @Jaace — 2014-04-29T16:22:05Z

After looking into this further, I’m noticing some weird stuff happening with php5-fpm. The site is working upon the initial `vagrant up` but upon halting and bringing it back up a few things are happening that I am still trying to sort out:

1. `vagrant@bedrockhub:~$ sudo service php5-fpm restart stop: Unknown instance: php5-fpm start/running, process 2852`

2. `sudo service php5-fpm start php5-fpm start/running, process 3015`

3. I check the processes with `ps -ef` and I do not see php5-fpm running anywhere and certainly not as pid 3015 (or whatever ID it happens to have at that moment).

4. `vagrant@bedrockhub:~$ sudo service php5-fpm stop stop: Unknown instance:`

---

## Post 29 by @callerc1 — 2014-04-30T07:36:13Z

@Jaace I can confirm I am running the same versions of VB, Vagrant and Ansible as yourself. For now i have just opted not to run `vagrant halt` whilst i continue with my project and revisit this issue later. So essentially i just ended up running `vagrant destroy` and `vagrant up` to get my VM back. `vagrant provision` seems to work well and i haven’t had any issues with this.

---

## Post 30 by @swalkinshaw — 2014-04-30T16:08:40Z

Thanks for the debugging guys. I’ll do some testing with `halt` and try to find out what’s going on.

---

## Post 31 by @swalkinshaw — 2014-04-30T21:45:29Z

I’ve fixed the problem. There were a few issues but the main one was that PHP-FPM sockets were set to live in `/var/run/php5-fpm/` which was created through Ansible on provision.

Problem is `/var/run` is reset on boot and PHP-FPM doesn’t handle creating the needed directory. Easiest fix was just to put sockets in the top level `/var/run` (example: `/var/run/php5-fpm-example.dev.sock`.

So the service failed to start since that dir didn’t exist. It all works now and I’ve tested it from scratch and `halt` then `up`.

Commit: [https://github.com/roots/bedrock-ansible/commit/96ee139578eab8019352fb417f0ffc7c5ecd76ab](https://github.com/roots/bedrock-ansible/commit/96ee139578eab8019352fb417f0ffc7c5ecd76ab)

---

## Post 32 by @Jaace — 2014-05-04T17:27:38Z

That seems to have done the trick for me! Thanks

---

## Post 33 by @swalkinshaw — 2014-05-04T17:38:28Z

Just an update:

I’ve made a new base Vagrant box with it already provisioned. Details here: [https://github.com/roots/bedrock-ansible#vagrant-box](https://github.com/roots/bedrock-ansible#vagrant-box)

---

## Post 34 by @callerc1 — 2014-05-06T12:40:39Z

Thanks and double thanks for the box :smile:

---

## Post 35 by @ionutzp — 2014-05-13T22:20:53Z

@swalkinshaw I’m a bit confused. How is this suppose to work exactly? Does cloning the bedrock/ansible and running vagrant up give me a devbox with wordpress and everything needed. Instead wordpress should already be downloaded somewhere before? as here [https://github.com/roots/bedrock-ansible/issues/1](https://github.com/roots/bedrock-ansible/issues/1) ?  
Thanks!

---

## Post 36 by @swalkinshaw — 2014-05-13T22:55:14Z

You need to download/clone Bedrock first and make sure the paths in the example `Vagrantfile` are correct relative to all your folders.

---

## Post 37 by @callerc1 — 2014-05-21T07:52:07Z

@swalkinshaw Did you get a chance to create an example Vagrantfile showing how to provision to DO? Im about to take the plunge myself so any help would be very much appreciated.

---

## Post 38 by @Jaace — 2014-05-21T14:13:39Z

Trying to get this to work with the new box… for some reason I’m getting the error when I’m running the ansible provisioner. I recently upgraded to Mavericks but I cannot find anything about needing to change anything with ansible or how to fix this error… any ideas? I’ve been googling this error and coming up with nothing about how to change the path for ansible. I’ve verified it’s installed with homebrew and up-to-date.

```
==> default: Running provisioner: ansible...
The executable 'ansible-playbook' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.
```

UPDATE: I needed to do a `brew uninstall ansible` and then re-install it. For some reason `brew update` was not upgrading ansible to it’s latest version. After re-installing I was able to access it via the command line also with `ansible --version`(1.6.1) so I know it’s working now.

Performing a `vagrant up` now runs through the process fine.

---

## Post 39 by @swalkinshaw — 2014-05-21T15:39:55Z

I’ve done it with this `Vagrantfile`: [https://gist.github.com/swalkinshaw/fcb08adfaf86a4be0806](https://gist.github.com/swalkinshaw/fcb08adfaf86a4be0806)

You need this plugin installed: [https://github.com/smdahlen/vagrant-digitalocean](https://github.com/smdahlen/vagrant-digitalocean) and the proper DO env vars set up as seen in the `Vagrantfile` for api keys etc.

But it requires more configuration that I don’t have right now. The prod box references a new `prod.yml` playbook instead of the normal `site.yml`. It’s basically the same but doesn’t run the `wordpress-sites` role.

So the steps would be something like this:

1. Run `vagrant prod up --no-provision`
2. Create a prod specific `prod.yml` playbook with the roles you want
3. Create a new `hosts` file with a `[wordpress-server-prod]` group and the DO ip/host
4. You could move the `group_vars/all` to be env specific at `group_vars/wordpress-server-prod` and `group_vars/wordpress-server` if you only want those vars to apply to each server
5. Run `vagrant prod provision`
6. Update Capistrano configs with the correct prod ip/host
7. Run `cap production deploy`

The steps are something like that…

Honestly I don’t think production servers should be managed with Vagrant. Maybe if you want a remote dev server. I’d probably just set up the servers manually (if you only have 1 per site or 1 total) and then run `ansible-playbook -i prod.yml hosts` manually.

---

## Post 40 by @callerc1 — 2014-05-21T16:45:04Z

Thanks for that Scott. That makes sense will give it a go for a remote staging/dev server. For production are you saying essentially set up the server manually but provision it with ansible?

---

## Post 41 by @swalkinshaw — 2014-05-21T17:34:30Z

Correct. Then you can look into just doing everything with Ansible. It has a built-in Digital Ocean module to manage servers.

---

## Post 43 by @Jaace — 2014-05-22T22:54:26Z

If I wanted to have more than one site on the Box, how would I change the hosts file on bedrock-ansible, /etc/hosts and the group\_vars/all file? I tried adding a new IP address for each in the hosts file and the /etc/hosts file but I’m not sure if that’s the correct way… do you have an example of this?

---

## Post 44 by @swalkinshaw — 2014-05-22T23:09:32Z

All you need to change is adding another site “item” in `group_vars/all`. See this Gist: [https://gist.github.com/swalkinshaw/12ab5364a41eacfee208](https://gist.github.com/swalkinshaw/12ab5364a41eacfee208)

`wordpress_sites` is just an array.

The `hosts` file is the remote servers. So adding another IP/host there actually means you have another remote server/VM.

---

## Post 45 by @btamm — 2014-06-02T20:24:46Z

I downloaded the bedrock-ansible and bedrock repos into the following locations:  
/Users/btamm/Sites/brandontamm/bedrock-ansible  
/Users/btamm/Sites/brandontamm/example.dev

I followed the instructions from bedrock-ansible, set the vagrant file and group\_vars and try to run ‘vagrant up.’ Everything works as supposed to, the machine boots, mounts shared folders, and then ttys to run provisioner: ansible and I receive the following error message:  
The executable ‘ansible-playbook’ Vagrant is trying to run was not  
found in the PATH variable. This is an error. Please verify  
this software is installed and on the path.

I have tried every variation of adjusting the path:  
ansible.playbook = './bedrock-ansible/site.yml’  
ansible.playbook = './site.yml’  
ansible.playbook = '…/bedrock-ansible/site.yml’  
ansible.playbook = ‘…/site.yml’

I am assuming the error has something to do with my path. I made no adjustments to site.yml and have not moved it from the original location. Am I missing something?

---

## Post 46 by @swalkinshaw — 2014-06-02T20:36:28Z

> [@btamm](#):
>
> ansible-playbook

That error message just means that the executable `ansible-playbook` couldn’t be found. Did you install Ansible first? If running `ansible-playbook` doesn’t work in your terminal, then it won’t work through Vagrant either.

---

## Post 47 by @btamm — 2014-06-02T21:23:54Z

\*\*SOLVED! Thanks again Scott.

Can’t tell you enough how much I appreciate the work you guys do. You guys are revolutionizing developer workflow!

Also - I like the Bedrock and Ansible setup, however, 2 questions.

1. Have you looked into using Docker vs. Vagrant/Ansible?
2. Reasons for choosing Vagrant over Ansible?
3. Future plans for Docker?

Anyways, keep up the good work and NO HURRY in getting back to me. Cheers!!

---

## Post 48 by @swalkinshaw — 2014-06-02T21:36:36Z

Glad you’re enjoying everything :smile:

1. Not too much yet. Docker is awesome but probably not needed in most basic server setups (which WP sites often are)

2. Well we’re using both of them? Didn’t choose one over the other. Vagrant is meant for development environments so that’s what we’re using it for. And Ansible for server provisioning.

3. Probably not anytime soon.

---

## Post 49 by @btamm — 2014-06-02T22:31:39Z

The VM that is created is 512 mb. My macbook runs with 8gb ram. - is there a variable I can change to increase the amount of dedicated ram to the virtual machine?

---

## Post 50 by @swalkinshaw — 2014-06-02T23:27:50Z

[http://docs.vagrantup.com/v2/virtualbox/configuration.html](http://docs.vagrantup.com/v2/virtualbox/configuration.html) at the bottom

---

## Post 52 by @swalkinshaw — 2014-06-03T03:12:57Z

See question #3 and my answer in this thread: [Php error when app/themes or app/plugins directories are not empty](http://discourse.roots.io/t/php-error-when-app-themes-or-app-plugins-directories-are-not-empty/1751)

---

## Post 53 by @bigsweater — 2014-06-03T08:48:47Z

I’m a little bit confused here–does this mean I can run multiple sites from a single Bedrock Ansible project simultaneously, like one would with MAMP and virtual hosts? If that’s the case, I may be missing something.

Setting up my `group_vars/all` file as instructed above works until Composer runs, which throws this error:

`stdout: Composer could not find a composer.json file in /srv/www/example.dev/current`

My Vagrantfile is pretty minimally modified:

```
config.vm.network :private_network, ip: '192.168.50.5'
 # config.vm.hostname = 'example.dev' # This is taken care of via /group_vars/all, right?

 # adjust paths relative to Vagrantfile
 config.vm.synced_folder '../sites', '/srv/www', owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
```

My impression was that the synced folder would be `your/sites/dir` instead of `your/sites/dir/specificsite.dev`. But it doesn’t look like Vagrant is seeing my development files at all. What am I doing wrong here?

---

## Post 54 by @swalkinshaw — 2014-06-04T00:14:03Z

> [@bigsweater](#):
>
> config.vm.synced\_folder ‘…/sites’, ‘/srv/www’, owner: ‘vagrant’, group: ‘www-data’, mount\_options: [‘dmode=776’, ‘fmode=775’]

Yeah, `config.vm.hostname` isn’t really needed but should probably be set to something. Could just be `sites.dev` or something for identification purposes.

Right now you need to explicitly set up every individual site as a synced folder.

```
config.vm.synced_folder '../sites/site1', '/srv/www/site1/current', owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
config.vm.synced_folder '../sites/site2', '/srv/www/site2/current', owner: 'vagrant', group: 'www-data', mount_options: ['dmode=776', 'fmode=775']
```

---

## Post 55 by @bigsweater — 2014-06-04T14:59:47Z

Ohh. Duh. Well there’s my problem. I thought I tried adding multiple synced folders and it only found one of them, but it probably failed on the first one because my directory structure was bad.

I’ll try it as soon as I’m back at the ole desk, though I’m strongly considering keeping one VM per project.

---

## Post 56 by @swalkinshaw — 2014-06-11T00:15:24Z

Just a note that I’ve committed a fix for the admin slowness/update errors: [https://github.com/roots/bedrock-ansible/commit/38c32986ebe2c73df02ab86688f43c12c6bab431](https://github.com/roots/bedrock-ansible/commit/38c32986ebe2c73df02ab86688f43c12c6bab431)

---

## Post 57 by @mAAdhaTTah — 2014-07-08T20:04:32Z

Is it safe to assume that this Ansible playbook is secure for provisioning a production server? It sounds like you use it yourself for this, but just wondering what your thoughts are.

---

## Post 58 by @swalkinshaw — 2014-07-08T20:21:42Z

The only other things you’d need for production are:

- Root MySQL pw
- Maybe firewall/fail2ban rules or SSH lock down
- WP caching plugin
