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
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.,
The module components should follow a specific structure in
- Contains the
patchesfolder 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>is the location where you extracted the Puppet modules distribution.
- Contains the
init.ppfile. Puppet module class should inherit from
wso2base. This can follow the same structure in other modules. Additionally, the
init.ppfile should have the product specific Hiera lookups. If your template has product specific Puppet variables, it should be mentioned in the
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.
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:
worker The latter mentioned profiles are mapped to the
worker.yaml files respectively.
The hierarchy of the Hiera data set should be as follows:
Tips on creating Hiera configuration data files
- The Hiera data files should be created based on the product profiles.
wso2as 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.,
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.
For example, the following is the Hiera value for WSO2 ESB
defaultprofile. You can use it as a starting point by adjusting the product name (i.e.,