Bedrock Vagrant/Ansible released

All you need to change is adding another site “item” in group_vars/all. See this Gist:

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.

I downloaded the bedrock-ansible and bedrock repos into the following locations:

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?

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.

**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!!

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.

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? at the bottom

See question #3 and my answer in this thread: Php error when app/themes or app/plugins directories are not empty

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/

My Vagrantfile is pretty minimally modified: :private_network, ip: ''
 # config.vm.hostname = '' # 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/ But it doesn’t look like Vagrant is seeing my development files at all. What am I doing wrong here?

Yeah, config.vm.hostname isn’t really needed but should probably be set to something. Could just be 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']

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.

Just a note that I’ve committed a fix for the admin slowness/update errors:

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.

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

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