-
Notifications
You must be signed in to change notification settings - Fork 64
Use WSO2 Puppet Modules in puppet master agent Environment
##Table of Contents
##Overview
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.
Note: Tested Operating systems.
- Ubuntu 14.04
- RedHat Enterprise Linux 6.7
This document contains installation instructions specific to Ubuntu 14.04 LTS.
##Instructions For the ease of understanding, we have divided the instructions into 3 Tasks.
- Task 1. Setup two instances
- Task 2. Setup Puppet Master and puppet agent
- Task 3. Perform a catalog run to configure product instance
This can be either two cloud instances, two physical computer instances or two local VM instances.
You must be able to ssh to both the instances. One will be prepared as Puppet Master and the other as Puppet Agent.
First, we will install Puppet Master and Puppet Agent. Then we will configure both Master and Agent respectively.
-
Login to Puppet Master as the super user.
-
Issue the following 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 Puppet distribution > wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb > dpkg -i puppetlabs-release-trusty.deb > apt-get update > apt-get install puppetmaster
-
Check the puppet version as:
puppet -V
.
Puppet version Should be 3.8.3 or higher. -
Edit
etc/hostname
file and set property hostname.puppetmaster
-
Edit your Puppet Master hosts file
/etc/hosts
as follows and set Puppet Master hostname.127.0.0.1 localhost 127.0.0.1 puppetmaster
-
For production deployments configure Puppet Master with Passenger and Apache https://docs.puppet.com/puppet/4.5/reference/passenger.html
-
Login to Puppet Agent as the super user.
-
Issue the following commands.
> wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb > dpkg -i puppetlabs-release-trusty.deb > apt-get update > apt-get install puppet
-
Edit
etc/hostname
file and set property hostname.qaa-node-1
-
Edit
/etc/hosts
file of your Puppet Agent.127.0.0.1 localhost 192.168.19.XXX puppet # Puppet Master's IP address
-
Login to Puppet Master as the super user.
-
Create a directory
/etc/puppet/environments/production/
. -
Modify
/etc/puppet/puppet.conf
file of Puppet Master appending the following to[main]
and[master]
sections accordingly.[main] dns_alt_names=puppetmaster,puppet environmentpath = $confdir/environments hiera_config = /etc/puppet/hiera.yaml [master] autosign=true
-
Before restarting the Puppet Master, clean all certificates, including Puppet Master’s certificate which is having its old DNS alt names.
> puppet cert clean --all
-
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
-
Download git repo files
i. git clone wso2/puppet-modules [1] to a temp folder -
Prepare puppet modules
i. Copy all modules in../puppet-modules/modules
to/etc/puppet/environments/production/modules/
.
ii. Install java module from puppet forge [2].```bash > puppet module install 7terminals-java ```
iii. Install stdlib module from puppet forge [3].
```bash > puppet module install puppetlabs-stdlib ```
-
Prepare hieradata
i. Copy../puppet-modules/hiera.yaml
to/etc/puppet
ii. Edithiera.yaml
file yaml data directory location as follows.```yaml :yaml: :datadir: "/etc/puppet/hieradata/%{::environment}" ```
iii. Copy
../puppet-modules/hieradata
folder to/etc/puppet/
iv. Rename/etc/puppet/hieradata/dev -> /etc/puppet/hieradata/production
-
Prepare
site.pp
manifest
i. Copy../puppet-modules/manifests/site.pp
to/etc/puppet/environments/production/manifests/
-
Prepare files/packs
i. Copy the pack file (e.g.:wso2am-1.9.1.zip
) to/etc/puppet/environments/production/modules/wso2am/files
ii. Create folder../modules/wso2base/files
iii. Copy jdk installation file (e.g.:jdk-7u79-linux-x64.gz
) to../modules/wso2base/files
iv. Add jdk version (home) and filename information to/etc/puppet/environments/production/modules/wso2base/manifests/java.pp
v. Add host entry to /etc/puppet/hieradata/production/wso2/common.yaml as followspuppetmaster: ip_address: [your_puppet_master_ip_here] hostname: puppet
-
Login to Puppet Agent as the super user
-
Modify
/etc/puppet/puppet.conf
file of Puppet Agent appending the following to the[main]
section.[main] server = puppet
Following sample files attached are for APIM 1.9.1
[4], [5].
-
Modify the
deployment.conf
file according to your product. -
Login to Puppet Agent as super user.
-
Copy the modified file
deployment.conf
[4] ->/opt/deployment.conf
. -
Copy the file
setup.sh
[5] ->/opt/setup.sh
and execute the following command.> chmod 755 setup.sh
-
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
platform=default
[5] setup.sh
#!/bin/bash
echo "#####################################################"
echo " Starting cleanup "
echo "#####################################################"
ps aux | grep -i wso2 | awk '{print $2}' | xargs kill -9
echo "#####################################################"
echo " Setting up environment "
echo "#####################################################"
mkdir -p /etc/facter/facts.d
cp deployment.conf /etc/facter/facts.d/deployment_pattern.txt
echo "#####################################################"
echo " Installing "
echo "#####################################################"
puppet agent --enable
puppet agent -vt
puppet agent --disable