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.
Using WSO2 Puppet Modules in Master/Agent Setup - WSO2 Puppet Modules 2.0.0 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This will provide a sequence for you to follow in testing your WSO2 product of interest for a standalone deployment setup in a given puppet agent instance. This can be considered as a guide to setting up your own Puppet Master/Agent environment given that you manually set up the instances.

For the ease of understanding, the instructions are divided into 3 main steps.

Step 1 - Setup two instances

This can be either two cloud instances, two physical computer instances, or two local VM instances.
You must be able to SSH into both of the instances. Configure one instance as the Puppet Master and the other as Puppet Agent.

Step 2 - Setup Puppet Master and Puppet Agent

Follow the instructions below to initially install and then configure the Puppet Master and Puppet Agent respectively.

2.1. Install Puppet

2.1.1. Puppet Master
  1. Sign into Puppet Master as the super user.
  2. Issue the following commands. Please refer the inline comments to identify the reason behind executing these commands.

    # Sync time between the Master and the Agent
    ntpdate pool.ntp.org ; apt-get update && sudo apt-get -y install ntp ; service ntp restart  
    cd /tmp  
     
    # Download and install the Puppet distribution
    wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb  
    dpkg -i puppetlabs-release-trusty.deb  
    apt-get update  
    apt-get install puppetmaster 
     
  3. Check the Puppet version

     puppet -V

    The Puppet version should be 3.8.3 or higher.

  4. Edit the /etc/hostname file and set the property hostname.

    [puppet-master-ip] puppetmaster
  5. Edit your Puppet Master hosts file, which is /etc/hosts, as follows and set the Puppet Master hostname.

    127.0.0.1 localhost
    127.0.0.1 puppetmaster 
2.1.2. Puppet Agent
  1. Sign into Puppet Agent as the super user.
  2. Issue the following commands to download and install the Puppet distribution.

    apt-get update  
    apt-get install puppet
     
  3. Edit the /etc/hostname file and set the property hostname.

    {host-ip}  qaa-node-1
  4. Edit the /etc/hosts file of your Puppet Agent.

    127.0.0.1 localhost  
    192.168.19.XXX puppet # Puppet Master's IP address 

2.2. Configure Puppet

2.2.1. Puppet Master
  1. Sign into the Puppet Master as the super user.
  2. Create the following directory.
     /etc/puppet/environments/production/
  3. Modify the /etc/puppet/puppet.conf file that corresponds to the Puppet Master by appending the following to the [main] and [master] sections accordingly.

    [main]
    dns_alt_names=puppetmaster,puppet
    environmentpath = $confdir/environments
    hiera_config = /etc/puppet/hiera.yaml
    [master]
    autosign=true
  4. Before restarting the Puppet Master, clean all certificates, including Puppet Master’s certificate which has its old DNS alt names.

    puppet cert clean --all
  5. Restart the Puppet Master for new configuration changes to take effect and to regenerate the certificate with the new dns_alt_names.

    service puppetmaster restart
  6. Download the Git repo files.
    Do this by cloning the Puppet Module files to a temporary folder.

    git clone https://github.com/wso2/puppet-modules.git <LOCAL_FOLDER_PATH>
  7. Prepare Puppet Modules as follows:

    1. Copy all the modules in  <PUPPET_MODULES_HOME>/modules to/etc/puppet/environments/production/modules/.

    2. Install the Java module from puppetforge.

      puppet module install 7terminals-java 
    3. Install the stdlib module from puppetforge.

      puppet module install puppetlabs-stdlib  
  8. Prepare Hieradata.

    1. Copy the <PUPPET_MODULES_HOME>/hiera.yaml file to the /etc/puppet directory.

    2. Edit the hiera.yaml file yaml data directory location as follows:

      :yaml: 
      	:datadir:  "/etc/puppet/hieradata/%{::environment}"  
    3. Copy the <PUPPET_MODULES_HOME>/hieradata folder to the /etc/puppet  directory.

    4. Rename the /etc/puppet/hieradata/dev directory to the /etc/puppet/hieradata/production directory.

  9. Prepare the site.pp manifest.
    Copy the <PUPPET_MODULES_HOME>/manifests/site.pp file to the /etc/puppet/environments/production/manifests directory.

  10. Prepare the files/packs. 

    1. Copy the pack file (e.g, wso2am-1.9.1.zip) to the /etc/puppet/environments/production/modules/wso2am/files directory.

    2. Copy the JDK installation file (e.g., jdk-7u79-linux-x64.gz) to the /etc/puppet/modules/wso2base/files directory.

    3. Add the JDK version (home) and filename information to the /etc/puppet/hieradata/production/common.yaml file.

2.2.2. Puppet Agent
  1. Sign into the Puppet Agent as the super user.
  2. Modify the /etc/puppet/puppet.conf file that corresponds to the Puppet Agent by appending the following to the[main] section.

    [main]  
    server = puppet

Step 3 - Set Facter variables and perform a Puppet Agent run

Following sample files attached are for APIM 1.9.1 [4], [5].

  1. Modify the deployment.conf file according to your product.
  2. Login to Puppet Agent as super user.
  3. Copy the modified file deployment.conf [4] -> /opt/deployment.conf.
  4. Copy the file setup.sh [5] -> /opt/setup.sh and execute the following command.

    chmod 755 setup.sh
  5. Run following command to setup WSO2 product instance.

    ./setup.sh

An instance of a standard WSO2 product given version of your choice will be installed.
e.g.:
CARBON_HOME -> /mnt/10.0.2.89/wso2am-1.9.1
For APIM 1.9.1 the complete deployment time (deployment + server startup) will be approximately 1 minute.

[1] https://github.com/wso2/puppet-modules
[2] https://forge.puppetlabs.com/7terminals/java
[3] https://forge.puppetlabs.com/puppetlabs/stdlib
[4] deployment.conf

    product_name=wso2am
product_version=1.9.1
product_profile=default
vm_type=openstack

  

[5] setup.sh

      #!/bin/bash
echo  "#####################################################" 
echo  " Starting cleanup " 
echo  "#####################################################" 
ps aux | grep -i wso2 | awk { 'print $2' } | xargs kill -9
#rm -rf /mnt/*
sed -i  '/environment/d'  /etc/puppet/puppet.conf
echo  "#####################################################" 
echo  " Setting up environment " 
echo  "#####################################################" 
rm -f /etc/facter/facts.d/deployment_pattern.txt
mkdir -p /etc/facter/facts.d

while read -r line; do declare  $line
      ; done < deployment.conf  

echo product_name=$product_name >> /etc/facter/facts.d/deployment_pattern.txt  
echo product_version=$product_version >> /etc/facter/facts.d/deployment_pattern.txt  
echo product_profile=$product_profile >> /etc/facter/facts.d/deployment_pattern.txt  
echo vm_type=$vm_type >> /etc/facter/facts.d/deployment_pattern.txt  

echo  "#####################################################"   
echo  " Installing "   
echo  "#####################################################"   

puppet agent --enable  
puppet agent -vt  
puppet agent --disable  
  • No labels