Bedrock-ansible....and production?

Ansible playbook designed to be used with Bedrock to configure dev & production servers for Bedrock-based WordPress sites. This playbook will install the common LEMP (Linux/Nginx/MySQL/PHP) stack with PHP 5.5 and MariaDB as a drop-in MySQL replacement (but better) on Ubuntu 14.04 Trusty LTS.

I’ve got a local dev setup with bedrock-ansible (Win 7 host for 14.04 Trusty LTS 32bit) and it is quite nice. I’m wondering if you can share a bit more on suggestion to use it for production servers for those new to the playbook world.

The two questions that come to mind specifically at the moment:

  1. Production would not have / use vagrant - What more steps req’d other than manual playbook execution?
  2. If base OS is Cent OS or another version of linux, how much difference does that make to the EMP in LEMP?

Thx,
J

Ansible at its most basic is just this:

ansible-playbook -i site.yml hosts

Which just means “run the site.yml playbook on the hosts file”. And a hosts file is pretty simple. You can see examples here: http://docs.ansible.com/intro_inventory.html

When using Vagrant with Ansible, it automatically creates a hosts file so you never really see that. So back to question #1:

  1. You can just create a hosts file with your production hostname/ip in there. group_vars/all will apply to all hosts as its name suggests. So you may want to rename that to group_vars/dev and make a new group_vars/prod with your production sites. Then your hosts file would look like:
[prod]
prod-server.com

And you would run ansible-playbook -i site.yml hosts as usual. You can always make a new playbook based on site.yml if you want to change what roles are run as well. Little more info here as well: Bedrock Vagrant/Ansible released

  1. Using this playbook on CentOS would require a lot more changes as it’s all set up to use apt and Ubuntu ppa’s.

I’m running into some difficulties running Bedrock-ansible on my production server. I’m getting this error:

TASK: [wordpress-sites | Create database of sites] **************************** 
<107.170.145.137> ESTABLISH CONNECTION FOR USER: me
fatal: [default] => One or more undefined variables: 'str object' has no attribute 'env'

FATAL: all hosts have already failed -- aborting

Unfortunately, I’m so unfamiliar with all of this that I don’t even know where to look. Thoughts?

Can’t really do much to debug without your files like group_vars. Seems like you’ve defined something wrong since it can’t find env which should be an attribute on wordpress_sites: https://github.com/roots/bedrock-ansible/blob/master/group_vars/all#L21

I misnamed my group_vars file. The name has to match the hosts variable in prod.yml. Thanks.

1 Like

RE: CentOS / RHEL:

Seems like a good alternative path that I’m beginning to explore.