bbatsche.WordPress

Ansible WordPress Role

Build Status

This role will download WordPress and automatically configure it to connect to a local MySQL database. It will also configure the required cryptographic keys and salts to make sure your WordPress site is secure.

Requirements

This role assumes you already have PHP installed and properly configured. It can be used in conjunction with bbatsche.Phpenv seamlessly, but it is not an explicit dependency.

Role Variables

  • wordpress_version — Version of WordPress to download. Default: 4.5.1
  • domain — Site domain to install WordPress under
  • db_name — MySQL database to use for WordPress
  • db_host — MySQL server to connect to. Default: "127.0.0.1"
  • new_db_user — MySQL user WordPress will use to connect
  • new_db_pass — Password for MySQL user
  • storage_dir — Cryptographic keys are generated using the Ansible password lookup utility. Those keys will be stored under this directory on the local computer
  • http_root — Location to store files for sites. Default: /srv/http

Note: The dependencies for this role have multiple other variables that they require as well! Pay attention to the documentation for the other required roles.

Dependencies

This role depends on bbatsche.MySQL-Manage, which in turn requires bbatsche.MySQL-Install. These must be installed before using this role.

ansible-galaxy install bbatsche.MySQL-Install
ansible-galaxy install bbatsche.MySQL-Manage

Example Playbook

- hosts: servers
  roles:
  - role: bbatsche.WordPress
    domain: my-blog.com
    db_name: wordpress_db
    new_db_user: wordpress_user
    new_db_pass: super_secure_password

License

MIT

Testing

Included with this role is a set of specs for testing each task individually or as a whole. To run these tests you will first need to have Vagrant and VirtualBox installed. The spec files are written using Serverspec so you will need Ruby and Bundler. Note: To keep things nicely encapsulated, everything is run through rake, including Vagrant itself. Because of this, your version of bundler must match Vagrant's version requirements. As of this writing (Vagrant version 1.8.1) that means your version of bundler must be between 1.5.2 and 1.10.6.

To run the full suite of specs:

$ gem install bundler -v 1.10.6
$ bundle install
$ rake

To see the available rake tasks (and specs):

$ rake -T

There are several rake tasks for interacting with the test environment, including:

  • rake vagrant:up — Boot the test environment (Note: This will not run any provisioning tasks.)
  • rake vagrant:provision — Provision the test environment
  • rake vagrant:destroy — Destroy the test environment
  • rake vagrant[cmd] — Run some arbitrary Vagrant command in the test environment. For example, to log in to the test environment run: rake vagrant[ssh]

These specs are not meant to test for idempotence. They are meant to check that the specified tasks perform their expected steps. Idempotency can be tested independently as a form of integration testing.

About

Downloads WordPress and configures basic DB and encryption parameters automatically

Install
ansible-galaxy install bbatsche.WordPress
GitHub repository
License
Unknown
Downloads
87