Forge Home

wordpress

Install and configure WordPress with WP-CLI tool.

13,399 downloads

4,877 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 3.1.0 (latest)
  • 3.0.0
  • 2.0.0
  • 1.3.5
  • 1.3.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
  • 1.3.0
  • 1.2.0
  • 1.1.3
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Jun 1st 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x
  • Puppet >= 5.0.0 < 7.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'adullact-wordpress', '3.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add adullact-wordpress
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install adullact-wordpress --version 3.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

adullact/wordpress — version 3.1.0 Jun 1st 2019

wordpress

Table of Contents

  1. Description
  2. Setup - The basics of getting started with wordpress
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Description

This module downloads the WP-CLI tool and then uses it to download and configure WordPress instances.

This module does not manage a multisite installation but it can create one or several WordPress instances on same puppet node. Each instance, on the same node, has dedicated settings and can be managed separately.

Setup

What wordpress affects

As the name of module can explain, it affects WordPress installation and configuration.

This modules does not manage :

  • system account, owner of WordPress files.
  • nginx or apache vhost
  • mariadb or mysql database and user
  • php install

They have to be created before for instance by puppetlabs-mysql, puppetlabs-apache and puppetlabs-account.

Setup Requirements

This wordpress module depends on puppetlabs-stdlib and puppet-archive

Beginning with wordpress

The following very basic step will install WP-CLI tool :

class { 'wordpress' :
}

Usage

Typical installation

The following code :

  • downloads and installs WP-CLI.
  • downloads and installs core WordPress in the last available version.
  • creates tables in an already existing database wp_mywpname.
  • configures core WordPress
  • sets the title of the instance.
  • WP-CLI is ran as wp user. Files are owned by already existing user wp.
class { 'wordpress' :
  settings => {
    'mywpname.mydomaine.com' => {
      wproot        => '/var/www/mywpname',
      owner         => 'wp',
      dbhost        => 'YY.YY.YY.YY',
      dbname        => 'wp_mywpname',
      dbuser        => 'mywp_dbusername',
      dbpasswd      => 'secretpass',
      wpadminuser   => 'mywp_adminuser',
      wpadminpasswd => 'othersecret',
      wpadminemail  => 'foo@mydomain.com',
      wptitle       => 'the title is to deploy WordPress with puppet',
    }
  }
}

Typical installation + self update by WordPress

The following code :

  • downloads and installs WP-CLI.
  • downloads and installs core WordPress in the last available version.
  • creates tables in an already existing database wp_mywpname.
  • configures core WordPress
  • sets the title of the instance.
  • WP-CLI is ran as wp user. Files are owned by already existing user wp.
  • enables WordPress internal self update process (disabled by default).
class { 'wordpress' :
  settings => {
    'mywpname.mydomaine.com' => {
      wproot        => '/var/www/mywpname',
      owner         => 'wp',
      dbhost        => 'YY.YY.YY.YY',
      dbname        => 'wp_mywpname',
      dbuser        => 'mywp_dbusername',
      dbpasswd      => 'secretpass',
      wpadminuser   => 'mywp_adminuser',
      wpadminpasswd => 'othersecret',
      wpadminemail  => 'foo@mydomain.com',
      wptitle       => 'the title is to deploy WordPress with puppet',
      wpselfupdate  => 'enabled',
    }
  }
}

Typical installation + update by Puppet

The following code :

  • downloads and installs WP-CLI.
  • downloads and installs core WordPress in the last available version.
  • creates tables in an already existing database wp_mywpname.
  • configures core WordPress
  • sets the title of the instance.
  • WP-CLI is ran as wp user. Files are owned by already existing user wp.
  • disables WordPress internal self update process.
  • configures puppet to make WordPress core and language update to latest available version.

If an update occured (checked one time each day), you will find in /var/wordpress_archives :

  • dump of database that was there before the update.
  • archive of files that were there before the update.
class { 'wordpress' :
  settings => {
    'mywpname.mydomaine.com' => {
      ensure        => 'latest',
      wproot        => '/var/www/mywpname',
      owner         => 'wp',
      dbhost        => 'YY.YY.YY.YY',
      dbname        => 'wp_mywpname',
      dbuser        => 'mywp_dbusername',
      dbpasswd      => 'secretpass',
      wpadminuser   => 'mywp_adminuser',
      wpadminpasswd => 'othersecret',
      wpadminemail  => 'foo@mydomain.com',
      wptitle       => 'the title is to deploy WordPress with puppet',
    }
  }
}

Typical installation + add themes + add plugins + locale

The following code :

  • downloads and installs WP-CLI.
  • downloads and installs core WordPress in the last available version and in french.
  • creates tables in an already existing database wp_mywpname.
  • configures core WordPress
  • sets the title of the instance.
  • WP-CLI is ran as wp user. Files are owned by already existing user wp.
  • manages more than defaults themes and plugins provided with core.
class { 'wordpress' :
  settings => {
    'mywpname.mydomaine.com' => {
      wproot        => '/var/www/mywpname',
      owner         => 'wp',
      locale        => 'fr_FR',
      dbhost        => 'YY.YY.YY.YY',
      dbname        => 'wp_mywpname',
      dbuser        => 'mywp_dbusername',
      dbpasswd      => 'secretpass',
      wpadminuser   => 'mywp_adminuser',
      wpadminpasswd => 'othersecret',
      wpadminemail  => 'foo@mydomain.com',
      wptitle       => 'the title is to deploy WordPress with puppet',
      wpresources   => {
        plugin => [
          { name => 'plugin1', 'ensure' => 'present' },
          { name => 'plugin2', 'ensure' => 'absent' },
        ],
        theme => [
          { name => 'themenew', 'ensure' => 'latest' },
          { name => 'themeold', 'ensure' => 'absent' },
        ]
      },
    },
  },
}

Several installations

The following code makes two installations on same Puppet node with dedicated settings :

  • only WordPress in wp2.foo.org in updated by Puppet, the other is not updated at all.
  • the two WordPress instances use the same database server.
  • the list of used plugins and themes configure are differents in each intance.
class { 'wordpress': 
  settings => {
    'wp2.foo.org' => {
      ensure        => 'latest',
      owner         => 'wp2',
      locale        => 'fr_FR',
      dbhost        => 'XX.XX.XX.XX',
      dbname        => 'wordpress2',
      dbuser        => 'wp2userdb',
      dbpasswd      => 'secret_a',
      wproot        => '/var/www/wp2.foo.org',
      wptitle       => 'hola this wp2 instance is installed by puppet',
      wpadminuser   => 'wpadmin',
      wpadminpasswd => 'secret_b',
      wpadminemail  => 'bar@foo.org',
      wpresources   => {
        plugin => [
          { name => 'plugin_a', 'ensure' => 'latest' },
          { name => 'plugin_b', 'ensure' => 'absent' },
        ],
        theme => [
          { name => 'themenew_a', },
          { name => 'themeold_a', 'ensure' => 'absent' },
        ]
      },
    },
    'wp3.foo.org' => {
      owner         => 'wp3',
      dbhost        => 'XX.XX.XX.XX',
      dbname        => 'wordpress3',
      dbuser        => 'wp3userdb',
      dbpasswd      => 'secret_c',
      wproot        => '/var/www/wp3.foo.org',
      wptitle       => 'hola this wp3 instance is installed by puppet',
      wpadminuser   => 'wpadmin',
      wpadminpasswd => 'secret_d',
      wpadminemail  => 'bar@foo.org',
      wpresources   => {
        plugin => [
          { name => 'plugin_a', },
          { name => 'plugin_b', },
          { name => 'plugin_c', },
          { name => 'plugin_d', 'ensure' => 'absent' },
        ],
        theme => [
          { name => 'themenew_b', },
          { name => 'themeold_a', 'ensure' => 'absent' },
        ]
      },
    },
  },
}

Reference

Details in REFERENCE.md.

Limitations

This module is tested with following OSes :

  • Ubuntu 16.04
  • Debian 8, 9

Known bugs are listed in CHANGELOG.md file.

Even if module should work with Puppet4, Puppet 4 is end of life since 2019-01-01. So tests with Puppet 4 are removed. Acceptance tests are done with last available release of Puppet 5 and Puppet 6 (AIO).

PHP shiped with CentOS 7 is version 5.4. WordPress 5.2 requires at least 5.6.20. Default values for CentOS7 are not removed from the code. By this way we expect the module should works if php version requirement is respected. But, CentOS7 is removed from acceptance tests and from the list of compatible OSes.

Development

Home at URL https://gitlab.adullact.net/adullact/puppet-wordpress

Issues and MR are welcome.

Mirrored at URL https://github.com/adullact/puppet-wordpress

Release Notes/Contributors/License.

Details in CHANGELOG.md.

Copyright (C) 2018 Association des Développeurs et Utilisateurs de Logiciels Libres
                     pour les Administrations et Colléctivités Territoriales.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/agpl.html>.