Ansible Fabric Starter: Deploy Hyperledger Fabric to Multiple Instances

by Hleb Iodo and Sophie TurolAugust 28, 2018
Altoros introduces a utility that allows for deploying a blockchain network to multiple instances with a configurable amount of organizations and channels.

The need for automation

When manually deploying Hyperledger Fabric to multiple instances, you have to take numerous actions across all the instances involved. Naturally, this is both effort- and time-consuming. Furthermore, manual installation is highly prone to human error.

To save on operational costs, one needs an instrument capable of automating the deployment process. The Hyperledger ecosystem offers Cello Ansible agent for the very purpose, however, it’s still in the incubation phase.

In an attempt to simplify multi-instance deployment of Hyperledger Fabric, our blockchain team was working on a tool of its own. Today, Altoros is glad to announce the release of Ansible Fabric Starter—the result of the work done.


What is it?

Ansible Fabric Starter is an infrastructure-agnostic utility to deploy Hyperledger Fabric to multiple instances. Ansible Fabric Starter uses Docker containers managed through Docker Compose. The utility is, actually, a collection of three Ansible-based playbooks: install-dependencies.yml, config-network.yml, and start-network.yml. Ansible Fabric Starter also includes three Ansible roles:

  • common-packages to install default packages, e.g., Python libs for Docker, on target hosts
  • docker to install Docker and Docker Compose on target hosts
  • fabric to pull all the necessary Docker images for Hyperledger Fabric

The install-dependencies.yml playbook is responsible for calling the above-mentioned Ansible roles to install all the necessary software and prepare the target hosts for deployment.

The config-network.yml playbook generates configuration files for Hyperledger Fabric and Docker Compose and transfers them to the target hosts.

Finally, the start-network.yml installs and instantiates a chaincode, as well as creates the blockchain channels according to the configuration to start the network.

For production-grade purposes, Ansible Fabric Starter provides support for the Kafka orderer, though the Solo orderer is available, as well.



To get started with Ansible Fabric Starter, your machine should have:

  • The GNU/Linux operating system
  • Ansible v2.5.0 (and later)

The provisioned nodes by Ansible should have:

  • Ubuntu 16.04 or CentOS 7
  • Python
  • sudo access


Configuring the network

If a blockchain network is pre-configured (or you may want to run the default settings), you just need to specify an IP address of each host in ansible_host. For a user with sudo access, an IP address is specified in ansible_user. The domain and machine names (e.g., are mainly required for the Docker network, so you can set values you need.

Below, you will find three sample configuration schemas.

A network configuration of hosts_compact.yml with the Solo orderer and three organizations. The orderer service is hosted on the first organization node. Only a common channel is enabled.

A network configuration of hosts_dedicated_orderer.yml with the Solo orderer and three organizations. In this case, the orderer service is hosted on a separate node. Three private channels are enabled across all organizations.

In the example below, a network configuration of host_kafka.yml uses the Kafka orderer with three organizations. Here, each organization has its own copy of the orderer service. Three private channels are enabled across all organizations.


Deploying the network

First, insure that you are in the project-root directory by running the following command:

cd ansible-fabric-starter

By default, an Ansible inventory is located in the hosts.yml file. You can rename any configuration from the examples above or specify the correct inventory via the -i parameter. If a network is deployed from scratch, you may want to install all the dependencies:

ansible-playbook install-dependencies.yml -i hosts_kafka.yml

To keep your inventory configuration in hosts.yml, use the following command:

ansible-playbook install-dependencies.yml

After all the nodes are provisioned with all the necessary software, you can deploy the blockchain network to the configured instances:

ansible-playbook config-network.yml -i hosts_kafka.yml

A little hint: the config-network.yml playbook will include start-network.yml automatically.

If you need to redeploy the network without reconfiguration—to drop the ledger for example—just launch the start-network.yml playbook, but don’t forget about the inventory configuration:

ansible-playbook start-network.yml -i hosts_kafka.yml

Note: Each new deployment is configured to delete the existing Docker volumes and containers. It means that if you redeploy on a working system, all the data will be lost.



In a few clicks, Ansible Fabric Starter allows for deploying a blockchain network to multiple instances with a configurable amount of organizations and channels using either Kafka or Solo orderers. To learn more about Ansible Fabric Starter, please check out the project’s GitHub repo, which contains more info on deploying and testing the network, as well as exemplifies the tricky case for the hosts_kafka.yml configuration.


About the expert

Hleb Iodo is Blockchain DevOps Engineer at Altoros with 5+ years of experience with network engineering. He specializes in network configuration and maintenance, as well as continuous integration and delivery. Hleb’s interests include deployment automation, cloud-native apps, blockchain, and distributed software. He is also skilled in working with GNU/Linux and various cloud providers.


This blog post was written by Hleb Iodo and Sophie Turol.