Wrapper to create resources that compound webapps




5,771 latest version

2.8 quality score

Version information

  • 0.2.0 (latest)
  • 0.1.0
released Mar 26th 2017
This version is compatible with:
  • Puppet Enterprise 3.x
  • Puppet 3.x
  • CentOS

Start using this module


sbitio/webapp — version 0.2.0 Mar 26th 2017

Puppet Webapp

puppet forge version last tag

Wrapper to create resources that compound webapps.

Resources can be declared as local resources or exported ones.

Exported resources are tagged with node's FQDN and realized in those nodes upon the presence of the classes that implements the resources.


This module does not have any hard dependency (but stdlib) so it can work infrastructure-wide.

These are the modules Webapp works with:

How it works

First, include webapp class in each node of your infrastructure that may realize a part of the webapp (apache, mysql, solr).

Second, create webapp instances tagged with the fqdn of each node involved.

Webapp instances must be created only on one node. It doesn't need to be one of the tag nodes. For example, use the one you consider the master.


The realization of exported resources is based on defined(), so class webapp must be included after each related class.

This is how we do it in manifests/00_globals.pp:


include ::webapp
include ::ducktape

Example of use

Class webapp accepts $instances and $instance_defaults parameters. So you can define webapps in hiera as follows:

webapp::instance_defaults :
  port: 80
    - dbserver
    - webhead1
    - webhead2

webapp::instances :

# Create a webapp called `foobar.com`. This will be the servername and
# database name, user and password.
  foobar.com      : {}

# Create webapp `barbaz.com` without database.
  barbaz.com      :
    db_ensure     : absent

# Create webapp with name `ex`. This is the database name and user. Password
# is provided explicitly. Servername is provided explicitly, along with
# redirects and custom configuration for the virtual host.
# `vhost_ensure : present` will enforce a redirect 301 from example.com
# to www.example.com.
# This webapp is declared of type `drupal`, so a drush alias (name `ex`) will
# also be declared.
  ex              :
    type          : drupal
    servername    : example.com
    www_ensure    : present
    serveraliases :
      - example.net
      - www.example.net
    redirects     :
      302         :
        - source  : /under-construction
          dest    : http://www.example.info/landing
    vhost_extra   : |
      ExpiresActive  On
      ExpiresDefault "access plus 10 minutes"
    db_pass       : s3cr3t
    db_grants     :
        options    : ['GRANT']
        privileges : ['ALL']
        table      : '*.*'
        user       : 'root@localhost'
        options    : ['GRANT']
        privileges : ['SELECT']
        table      : 'ex.*'
        user       : 'reader@localhost'
    cron           :
      cron1 :
        command : '/usr/local/bin/cronjob.sh'
        hour    : 23
        minute  : 12

As shown webapp instances allows to define the virtualhost, database or solr instance behaviour to some extent. See webapp/instance.pp for detailed documentation on accepted parameters.


MIT License, see LICENSE file


Use contact form on http://sbit.io


Please log tickets and issues on GitHub