Skip to main content

Ansible Collection - republic.crypto

The Republic Crypto's republic.crypto Ansible Galaxy collection provides a set of roles for configuring blockchain infrastructure.

Note: These roles are designed to set up non-validator nodes. For validator nodes or other types of nodes, please check the chain's official documentation for additional configuration requirements.

Available Roles​

  • republic.crypto.aptos - Aptos
  • republic.crypto.avalanche - Avalanche
  • republic.crypto.cosmos - Cosmos-SDK
  • republic.crypto.mina - Mina
  • republic.crypto.sui - Sui
  • republic.crypto.polygon - Polygon
  • republic.crypto.berachain - Berachain
  • More roles are coming soon.

Installation​

You can install the collection using the following command:

ansible-galaxy collection install republic.crypto

Example: Setting up a CosmosHub Node​

# playbook.yml
---
- hosts: 'all'
gather_facts: true
become: true

pre_tasks:
- name: 'Install apt packages'
ansible.builtin.apt:
update_cache: true
cache_valid_time: 86400
pkg: python3

roles:
- role: republic.crypto.cosmos
chain_name: cosmoshub
data_dir: /mnt/data/.gaiad

Concept​

Ansible roles in this collection follow these general phases:

  1. Load variables
  2. Install binaries
  3. Initialize blockchain node
  4. Set configuration
  5. Sync chain data from public backup (if applicable)

Note: Not every role contains all phases.

Contributing​

To submit feedback or report bugs, please open an issue on GitHub.

Development​

Molecule Testing Framework​

Development and integration of roles are done using Molecule with the Vagrant driver. Set the following environment variables according to your system configuration:

export VAGRANT_DEFAULT_PROVIDER=libvirt
export MOLECULE_PROVIDER=libvirt
export MOLECULE_BOX=generic/ubuntu2004

You may also need to set ANSIBLE_ROLES_PATH:

cd republic-crypto-collection
export ANSIBLE_ROLES_PATH=$PWD

Local Setup​

It is recommended to develop inside a Python virtual environment:

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml

Start the Vagrant box:

vagrant init -m $MOLECULE_BOX
vagrant up

Run tests:

COSMOS_CHAIN_NAME=regen molecule test -s cosmos

Converge and verify:

COSMOS_CHAIN_NAME=cosmoshub molecule converge -s cosmos
COSMOS_CHAIN_NAME=cosmoshub molecule verify -s cosmos

To clean up:

COSMOS_CHAIN_NAME=cosmoshub molecule destroy -s cosmos

For Cosmos-based chains, set the COSMOS_CHAIN_NAME environment variable.

Build Ansible Galaxy Locally​

To build the local version of the Ansible Galaxy collection:

ansible-galaxy collection build --force

Install for local testing:

ansible-galaxy collection install republic-crypto-0.x.x.tar.gz --force

Access the Collection​

You can find the collection on Ansible Galaxy here.