This documentation is for WSO2 Puppet Modules version 2.0.0. View documentation for the latest release.
We have moved WSO2 Puppet Modules to separate product specific repositories, and as a result the puppet-modules repository, which this documentation is based on has been deprecated.
A new puppet-common repository has been introduced. Please find the new repository list here.
Creating a WSO2 Puppet Module with Hiera Data - WSO2 Puppet Modules 2.0.0 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

Follow the instructions below to create a WSO2 Puppet Module with Hiera data:

Step 1  - Create the Puppet module

A Puppet module includes the following components.

  • files  - Contains any static files that should be copied over to the location that is being configured using Puppet. This component serves as a file server for the Puppet Agent.

  • manifests  - Contains the business logic of the Puppet module. The Puppet manifests contain blocks of dependent instructions, after the execution of which, should result in the intended state.

  • templates  - Contains the template files that are combined with a set of values and applied in the target environment. These template files are suffixed by the .erb file extension.

├── hieradata
│   └── modules
│       └── wso2product
│          ├── files
│          ├── manifests
│          └── templates

Tips on create a Puppet module structure

Use the following guidelines when creating a Puppet module structure.

  • Use the same structure used in other Puppet modules (e.g., wso2am).

  • The module components should follow a specific structure in wso2/puppet-modules.

    • files
      • Contains the patches and configs folders. The patches folder stores any patches that are required, and the configs folder stores required files, such as MySQL Connector.
      • Use the relative file path from the Carbon home.
      • Always add the WSO2 product ZIP file in the <PUPPET_MODULES>/modules/<WSO2-PRODUCT-NAME>/files directory, where <PUPPET_MODULES> is the location where you extracted the Puppet modules distribution.
    • manifests
      Contains only init.pp file. Puppet module class should inherit from wso2base. This can follow the same structure in other modules. Additionally, the init.pp file should have the product specific Hiera lookups. If your template has product specific Puppet variables, it should be mentioned in the init.pp file.

    • templates
      Contains the Puppet template for the product. The template should only have the Puppet variables and it should not have any Hiera lookups within the template.

Step 2 - Create the Hiera configuration data set

To create the Hiera configuration data set, provide the Hiera data that is required for the templates, which were added to the Puppet module. The YAML files map to the product profiles that are available for each product. For example, for WSO2 ESB, there are three profiles, which are as follows: defaultmanager, and worker  The latter mentioned profiles are mapped to the default.yamlmanager.yaml, and worker.yaml files respectively.

The hierarchy of the Hiera data set should be as follows:

├── hieradata
│   └── dev
│       └── wso2
│           └── wso2product
│               └── product_version
│                   └── platform
│                       ├── default.yaml
│                       ├── profile1.yaml
│                       └── profile2.yaml

Tips on creating Hiera configuration data files

  • The Hiera data files should be created based on the product profiles.
  • Use wso2 as the namespace when defining keys in the Hiera data files.
  • Make sure you have the following values in the Hiera data files.
    • wso2::pack_filename : The product distribution file name (e.g.,
    • wso2::pack_extracted_dir : The target directory name to extract the product (e.g., wso2esb-4.9.0).
    • wso2::hostname : The hostname to be used in the instance.
    • wso2::service_name : The service name of the product.
    • wso2::file_list : List down all the product specific files that need to be copied.
    • wso2::template_list : List down all the product specific templates.

      wso2::template_list :
       - repository/conf/security/
       - repository/conf/security/
       - bin/
       - password-tm
      wso2::file_list :
       - repository/components/lib/mysql-connector-java-5.1.36-bin.jar
  • For example, the following is the Hiera value for WSO2 ESB default profile. You can use it as a starting point by adjusting the product name (i.e., wso2esb).

      - wso2esb
    wso2::pack_filename: "%{::product_name}-%{::product_version}.zip"
    wso2::pack_extracted_dir: "%{::product_name}-%{::product_version}"
    wso2::service_name: wso2esb
    wso2::hostname :
  • No labels