JacobDorman / bedrock-ansible

Ansible playbooks for a Bedrock based WordPress LEMP app server

Home Page:https://roots.io/bedrock/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bedrock-ansible

Build Status

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

What's included

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

Requirements

Installation

  1. Download/fork/clone this repo to your local machine.
  2. Run ansible-galaxy install -r requirements.yml -p vendor/roles to install external Ansible roles/packages.
  3. 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.

Development setup

  1. Edit group_vars/development and add your WordPress sites
  2. Run vagrant up

Remote server setup (staging/production)

For remote servers you'll need to have a base Ubuntu 14.04 server already created.

  1. Edit group_vars/<environment> and add your WordPress sites
  2. Edit hosts/<environment> and add your server IP/hostnames
  3. Run ansible-playbook -i hosts/<environment> server.yml

Deploying to remote servers

  1. Run ./deploy.sh <environment> <site name>
  2. To rollback a deploy, run ansible-playbook -i hosts/<environment> rollback.yml --extra-vars="site=<site name>"

Options

HHVM

HHVM can be used instead of PHP 5.6 by setting hhvm: true in group_vars/all.

WP Sites

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 on
  • local_path - path targeting Bedrock-based site directory
  • env - environment variables
    • wp_home - WP_HOME constant
    • wp_siteurl - WP_SITEURL constant
    • wp_env - WordPress environment
    • db_name - database name
    • db_user - database username
    • db_password - database password
    • db_host - database hostname
    • domain_current_site (required for multisite)

Additional options:

  • admin_password - WP admin user password
  • admin_email - WP admin email address
  • site_install - whether to install WordPress or not
  • site_title - WP site title
  • db_create - whether to auto create a database or not
  • db_import - Path to local sql dump file which will be imported
  • system_cron - Disable WP cron and use system's
  • admin_user - WP admin user name
  • multisite - hash of multisite options
    • enabled - Multisite enabled flag
    • subdomains - subdomains option
    • base_path - base path/current site path

Mail

Outgoing mail is done by the sSMTP role. Configure SMTP credentials in group_vars/all.

Security

The secure-root.yml playbook is provided to help secure your remote servers including better SSH security. See the Wiki for Locking down root.

Additional documentation

See the bedrock-ansible Wiki.

About

Ansible playbooks for a Bedrock based WordPress LEMP app server

https://roots.io/bedrock/

License:MIT License


Languages

Language:Shell 100.0%