Skip to content

Ansible Role linuxfabrik.lfops.wordpress

This role installs and configures the WordPress CMS.

Attention: It is intended that when you call http://{wordpress__url}} you will get a white page because no theme is installed. http://{wordpress__url}}/wp-admin works as expected.

Available since LFOps 2.0.0.

Dependent Roles

Any LFOps playbook that installs this role runs these for you. Optional ones can be disabled via the playbook's skip variables.

Tags

wordpress

  • Installs and configures wordpress.
  • Triggers: none.

wordpress:export

  • Exports the site content (posts, pages, comments, custom fields, categories and tags) as a wxr file.
  • Triggers: none.

wordpress:file_policy

  • chown -R --changes apache:apache {{ wordpress__install_dir }}.
  • restorecon -Fvr {{ wordpress__install_dir }}.
  • Triggers: none.

wordpress:update

  • Updates the WordPress core to wordpress__version. Also applies all DB migrations, and updates all plugins and themes.
  • Triggers: none.

Mandatory Role Variables

wordpress__admin_email

  • The Email of the WordPress admin user.
  • Type: String.

wordpress__admin_user

  • The WordPress admin user account.
  • Type: Dictionary.
  • Subkeys:

    • username:

      • Mandatory. Username.
      • Type: String.
    • password:

      • Mandatory. Password.
      • Type: String.

wordpress__database_user

  • The database user account with permissions on the wordpress__database_name database.
  • Type: Dictionary.
  • Subkeys:

    • username:

      • Mandatory. Username.
      • Type: String.
    • password:

      • Mandatory. Password.
      • Type: String.

wordpress__site_title

  • The WordPress site title.
  • Type: String.

wordpress__url

  • The WordPress URL, without http:// or https://.
  • Type: String.

Example:

# mandatory
wordpress__admin_email: 'webmaster@example.com'
wordpress__admin_user:
  username: 'wordpress-admin'
  password: 'linuxfabrik'
wordpress__database_user:
  username: 'wordpress'
  password: 'linuxfabrik'
wordpress__site_title: 'WordPress Test Site'
wordpress__url: 'wordpress.example.com'

Optional Role Variables

wordpress__database_host

  • The host on which the database is accessible.
  • Type: String.
  • Default: 'localhost'

wordpress__database_name

  • The name of the database.
  • Type: String.
  • Default: 'wordpress'

wordpress__disallow_file_edit

  • Prevent editing of plugin / theme files from the admin WebGUI. Strongly recommended to set this to true for security reasons.
  • Type: Bool.
  • Default: true

wordpress__install_dir

  • The installation directory for WordPress.
  • Type: String.
  • Default: '/var/www/html/{{ wordpress__url }}'

wordpress__plugins

  • List of WordPress plugin slugs. To get a list of already installed plugins, use the WordPress CLI sudo -u apache /usr/local/bin/wp plugin list --status=active.
  • Type: List of dictionaries.
  • Default: []
  • Subkeys:

    • name:

      • Mandatory. Plugin slug, path to a local zip file, or URL to a remote zip file.
      • Type: String.
    • state:

      • Optional. Either 'present' or 'absent'.
      • Type: String.
      • Default: 'present'

wordpress__theme

  • The WordPress theme to install. Accepts a theme slug, the path to a local zip file, or a URL to a remote zip file.
  • Type: String.
  • Default: unset

wordpress__version

  • The WordPress version to install. Possible options: version number, 'latest', 'nightly'.
  • Type: String.
  • Default: 'latest'

wordpress__wxr_export

  • Path to a WXR export file which will be imported after installing WordPress. The file includes posts, pages, comments, custom fields, categories and tags, and can be created using the wp-cli export function or the wordpress:export tag.
  • Type: String.
  • Default: unset

Example:

# optional
wordpress__database_host: 'localhost'
wordpress__database_name: 'wordpress'
wordpress__disallow_file_edit: true
wordpress__install_dir: '/var/www/html/{{ wordpress__url }}'
wordpress__plugins:
  - name: 'bbPress'
    state: 'present'
  - name: 'Akismet'
    state: 'absent'
wordpress__theme: 'twentysixteen'
wordpress__version: 'latest'
wordpress__wxr_export: '/tmp/wordpress.xml'

License

The Unlicense

Author Information

Linuxfabrik GmbH, Zurich