fb
WSO2 Enterprise Integrator 3 minutes

WSO2 and Ansible, how to setup an automated installation?

ThomasZielinski.jpg
Thomas Zielinski
Java Developer
Ansible Logo
Scroll

WSO2 and Ansible scriptingUsually the installation of a WSO2 product is simple. Just unzip the package and that’s all. This is, of course, in theory. Usually it is needed to customize the product. In the production environment, we have to use RDBMS database, what causes the changes in product configuration. If customers want to use the WSO2 product as distributed or clustered setup, the changes in configuration are needed too. Mostly, the customization is made once. In this case, it can be nice to have a tool which install the customized product on the servers. This blog is about WSO2 and Ansible and how you can setup an automated installation.

Ansible

Ansible is an open source automation platform. It can help you with configuration management, application deployment and task automation. It can also do IT orchestration, where you have to run tasks in sequence and create a chain of events which must happen on several different servers or devices.

Unlike Puppet or Chef, it doesn’t use an agent on the remote host. Instead Ansible uses SSH which is assumed to be installed on all the systems you want to manage. It’s written in Python which needs to be installed on the remote host. This means that you don’t have to setup a client server environment before using Ansible, you can just run it from any of your machines and from the clients point of view there is no knowledge of any Ansible server.

WSO2 product installation

The WSO2 installation manual defines the steps:

  • prerequisite software installed. i.e. Oracle Java
  • dedicated for WSO2 product’s user and group,
  • RDBMS database used for data,
  • setup and configuration for
    • standalone
    • distributed or
    • clustered installation,
  • secure the installation by secure vault.

This all installation steps should be made by the system administrator.

Automated installation – WSO2 and Ansible

The WSO2 installation can be automated. The installation can be made using Ansible scripts. Some of the scripts have to be customized for the required setup (like cluster) and some can be used as common (presented below). Ansible gives us a possibility to install the product on many servers.

WSO2 user and group

The sample script creates the WSO2 group when doesn’t exist. The same with the user.

WSO2 and Ansible.png

Installing WSO2 product using WSO2 WUM

The sample script installs the newest release of a WSO2 product using WSO2 Update Manager. The product is added to WUM and downloaded if is not operated. In other case is updated to the newest release.

WSO2 and Ansible-2.png

Customizing the product

The customization is made by processing and copying the customized WSO2 configuration files to the WSO2 product’s location. During the process, the variables defined in the templates are changed to the values.

WSO2 and Ansible-3.png


Database installation

This sample shows how to create database, load data tables definitions and create the user with privileges.

WSO2 ans Ansible - 4.png

Secure vault

The script shows how to secure the WSO2 product by encrypting the passwords in configuration files. Script calls the WSO2’s command ciphertool.sh.

WSO2 ans Ansible-5.png

Conclusion

Ansible is a great tool to automate the WSO2 installation process. Yenlo sees many opportunities to use Ansible for this purpose. This blog is just an example. Most of the scripts are common for the all WSO2 products (like presented in the article) or can be adapted for the required installation. We have Ansible roles (scripts) available for all WSO2 products to implement the products easily. Please contact us to see how we can help you with this efficiently.

If you want to, you can download the Ansible Sources here: wso2-automated-installation-with-ansible

If you have any questions about this blogpost contact us via the comments section of this blog. View also our WSO2 Tutorials, webinars or white papers for more technical information. Need support? We do deliver WSO2 Product Support, WSO2 Development SupportWSO2 Operational Support and WSO2 Training Programs.