bedrock-ansible is a set of Ansible playbooks to automatically configure servers and deploy WordPress sites. It easily creates development environments with Vagrant to help achieve development & production parity.
Configure complete Bedrock-based WordPress ready servers with a single command:
Command | |
---|---|
Development | vagrant up |
Staging/Production | ansible-playbook -i hosts/production server.yml |
Deploying | ./deploy.sh production example.com |
bedrock-ansible will configure a server with the following and more:
- Ubuntu 14.04 Trusty LTS
- Nginx
- PHP 5.6 (or HHVM)
- MariaDB as a drop-in MySQL replacement (but better)
- sSMTP (mail delivery)
- Memcached
- Composer
- WP-CLI
- Fail2ban
- ferm
- Ansible >= 1.8 - Installation docs
- Virtualbox >= 4.3.10 - Downloads
- Vagrant >= 1.5.4 - Downloads
- Vagrant-bindfs >= 0.3.1 - Docs (Windows users may skip this)
- Download/fork/clone this repo to your local machine.
- Run
ansible-galaxy install -r requirements.yml -p vendor/roles
to install external Ansible roles/packages. - Download/fork/clone Bedrock or have an existing Bedrock-based site ready.
You should now have the following directories at the same level somewhere:
project/ - Primary folder for the project
├── bedrock-ansible/ - This repo
└── example.com/ - A Bedrock-based site
Note: The full paths to these directories must not contain spaces or else Ansible will fail.
- Edit
group_vars/development
and add your WordPress sites - Run
vagrant up
For remote servers you'll need to have a base Ubuntu 14.04 server already created.
- Edit
group_vars/<environment>
and add your WordPress sites - Edit
hosts/<environment>
and add your server IP/hostnames - Run
ansible-playbook -i hosts/<environment> server.yml
- Run
./deploy.sh <environment> <site name>
- To rollback a deploy, run
ansible-playbook -i hosts/<environment> rollback.yml --extra-vars="site=<site name>"
HHVM can be used instead of PHP 5.6 by setting hhvm: true
in group_vars/all
.
In the environment files inside the group_vars
directory, wordpress_sites
is the top level dictionary used to define the WordPress sites/virtual hosts that will be created.
site_hosts
- hosts that Nginx will listen onlocal_path
- path targeting Bedrock-based site directoryenv
- environment variableswp_home
-WP_HOME
constantwp_siteurl
-WP_SITEURL
constantwp_env
- WordPress environmentdb_name
- database namedb_user
- database usernamedb_password
- database passworddb_host
- database hostnamedomain_current_site
(required for multisite)
Additional options:
admin_password
- WP admin user passwordadmin_email
- WP admin email addresssite_install
- whether to install WordPress or notsite_title
- WP site titledb_create
- whether to auto create a database or notdb_import
- Path to localsql
dump file which will be importedsystem_cron
- Disable WP cron and use system'sadmin_user
- WP admin user namemultisite
- hash of multisite optionsenabled
- Multisite enabled flagsubdomains
- subdomains optionbase_path
- base path/current site path
Outgoing mail is done by the sSMTP role. Configure SMTP credentials in group_vars/all
.
The secure-root.yml
playbook is provided to help secure your remote servers including better SSH security. See the Wiki for Locking down root.
See the bedrock-ansible Wiki.