Skip to content
Ansible playbooks for a WordPress LEMP stack
Python Ruby Shell PHP
Branch: master
Clone or download
Pull request Compare This branch is 38 commits ahead, 22 commits behind roots:master.
biinari Merge pull request #14 from Fatsoma/feature/update_trellis_1.0.3
Update from upstream roots/trellis 1.0.3
Latest commit 12de945 Jul 4, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Use Ruby for ssh-config trigger Dec 27, 2018
group_vars Merge tag '1.0.3' into feature/update_trellis_1.0.3 Jul 4, 2019
hosts Update some documentation notes Mar 29, 2016
lib/trellis Mark vars that shouldn't be templated with AnsibleUnsafe instead of raw Feb 28, 2019
roles Merge tag '1.0.3' into feature/update_trellis_1.0.3 Jul 4, 2019
.editorconfig Add reverse_www filter to fix www_redirect Feb 18, 2016
.gitignore Git ignore .sql files Jun 14, 2018
.rsync-exclude Add rsync exclude file Jun 14, 2018
.travis.yml Add Python 3.6 to Travis Dec 5, 2018 Update CHANGELOG [ci skip] Apr 30, 2019 Initial commit Apr 16, 2014 Merge tag '1.0.3' into feature/update_trellis_1.0.3 Jul 4, 2019
Vagrantfile Use all canonical site hosts for Landrush TLD (roots#1077) Apr 12, 2019
ansible.cfg Merge pull request #2 from Fatsoma/feature/ssh_conf Jun 14, 2018
deploy.yml Python version compatibility fixes Dec 5, 2018
dev.yml Merge tag '1.0.3' into feature/update_trellis_1.0.3 Jul 4, 2019
requirements.yml Update logrotate Dec 2, 2018
rollback.yml Allow overriding rollback variables Dec 14, 2018
server.yml Update to PHP 7.3 Dec 19, 2018
vagrant.default.yml Ansible 2.7 compatibility Dec 14, 2018
variable-check.yml Add tags to select includes and tasks Dec 30, 2015
xdebug-tunnel.yml Update to PHP 7.3 Dec 19, 2018


Release Build Status

Ansible playbooks for setting up a LEMP stack for WordPress.

  • Local development environment with Vagrant
  • High-performance production servers
  • Zero-downtime deploys for your Bedrock-based WordPress sites

What's included

Trellis will configure a server with the following and more:

  • Ubuntu 18.04 Bionic LTS
  • Nginx (with optional FastCGI micro-caching)
  • PHP 7.3
  • MariaDB (a drop-in MySQL replacement)
  • SSL support (scores an A+ on the Qualys SSL Labs Test)
  • Let's Encrypt for free SSL certificates
  • HTTP/2 support (requires SSL)
  • Composer
  • WP-CLI
  • sSMTP (mail delivery)
  • MailHog
  • Memcached
  • Fail2ban and ferm


Full documentation is available at


Make sure all dependencies have been installed before moving on:

Windows user? Read the Windows getting started docs for slightly different installation instructions.


The recommended directory structure for a Trellis project looks like:      # → Root folder for the project
├── trellis/      # → Your clone of this repository
└── site/         # → A Bedrock-based WordPress site
    └── web/
        ├── app/  # → WordPress content directory (themes, plugins, etc.)
        └── wp/   # → WordPress core (don't touch!)

See a complete working example in the repo.

  1. Create a new project directory:
$ mkdir && cd
  1. Install Trellis:
$ git clone --depth=1 && rm -rf trellis/.git
  1. Install Bedrock into the site directory:
$ composer create-project roots/bedrock site

Update trellis

Clone Fatsoma fork of trellis to your preferred location or pull the latest changes if you already have a clone.

git clone $TRELLIS_DIR

Copy files from trellis into your project trellis directory (run from your clone of trellis):

PROJECT_DIR=~/code/wp    # set to your project directory

rsync -av --exclude-from .rsync-exclude ./ "${PROJECT_DIR}/trellis"

Check for differences in:


Local development setup

  1. Configure your WordPress sites in group_vars/development/wordpress_sites.yml and in group_vars/development/vault.yml
  2. Ensure you're in the trellis directory: cd trellis
  3. Run vagrant up

Read the local development docs for more information.

Remote server setup (staging/production)

For remote servers, installing Ansible locally is an additional requirement. See the docs for more information.

A base Ubuntu 18.04 (Bionic) server is required for setting up remote servers. OS X users must have passlib installed.

  1. Configure your WordPress sites in group_vars/<environment>/wordpress_sites.yml and in group_vars/<environment>/vault.yml (see the Vault docs for how to encrypt files containing passwords)
  2. Add your server IP/hostnames to hosts/<environment>
  3. Specify public SSH keys for users in group_vars/all/users.yml (see the SSH Keys docs)
  4. Run ansible-playbook server.yml -e env=<environment> to provision the server

Read the remote server docs for more information.

Deploying to remote servers

  1. Add the repo (Git URL) of your Bedrock WordPress project in the corresponding group_vars/<environment>/wordpress_sites.yml file
  2. Set the branch you want to deploy
  3. Run ./bin/ <environment> <site name>
  4. To rollback a deploy, run ansible-playbook rollback.yml -e "site=<site name> env=<environment>"

Read the deploys docs for more information.


Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Trellis sponsors

Help support our open-source development efforts by becoming a patron.

Kinsta Harness Software KM Digital itineris Hébergement Web Québec


Keep track of development and community news.

You can’t perform that action at this time.