Ansible role to manage elixir nodes
- Introduction to Ansible
- Why Use Ansible?
- Prerequisites
- Installing Ansible
- Setting Up Your Environment
- Secret Management
- Running Ansible Inventory
- Health Check examples
- Additional Resources
- Contribution Guidelines
- License
- Changelog
Ansible is an open-source automation tool that simplifies the process of configuration management, application deployment, and task automation. It uses a simple, human-readable language (YAML) to describe automation jobs, which allows you to manage complex deployments easily.
- Agentless: No need to install any software on the nodes you manage.
- Simple: Uses YAML for configuration, which is easy to read and write.
- Powerful: Can manage complex deployments and configurations.
Before you start, ensure you have the following:
- A machine with Ansible installed (control node).
- SSH access to the target machines (managed nodes).
To install Ansible on your control node, follow these steps:
sudo apt update
sudo apt install ansible
brew install ansible
For other operating systems, refer to the Ansible installation guide.
-
Clone the Repository:
git clone https://github.com/your-repo/ansible-elixir.git cd ansible-elixir
-
Create a Virtual Environment (optional but recommended):
python3 -m venv venv source venv/bin/activate
-
Install Required Ansible Collections:
ansible-galaxy install -r requirements.yml
-
Modify the Ansible Configuration File:
Edit the
ansible.cfg
file to set the inventory path and any other necessary configurations. Here is an example of what you might need to add or modify:[defaults] inventory = ./inventory remote_user = root private_key_file = ~/.ssh/id_ed25519 host_key_checking = False
This configuration sets the inventory file path, remote user, private key file, and disables host key checking.
To manage your secrets, create a <Server-IP>.yml
file and populate it with the necessary credentials. This file should be kept secure and not committed to version control (i.e. add to your .gitignore).
We recommend backing up your secrets using 1Password for simple secret storage.
mkdir host_vars && cd host_vars && touch IP.yml
Copy below into IP.yml. Not all values are required.
telegram_bot_token: "********"
telegram_chat_id: "********"
private_key_path: "/Path/.ssh/id_rsa"
IP: 10.101.10.101
WALLET_PRIVATE_KEY: "********"
WALLET_ADDRESS: "Address"
GRAFANA_ADMIN_PASSWORD: "********"
server_name: "example-01.axol.io"
Inventory example
#IP of Host
[servers]
IP ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_rsa
To run the Ansible inventory, use the following command:
ansible-playbook -i inventory main.yml
This command will execute the playbook defined in main.yml
using the hosts specified in the inventory
file.
curl http://localhost:17690/health | jq
{
"status": "OK",
"started_at": "2024-10-13 09:44:39",
"data_frame_version": "1.0.1",
"order_proposal_version": "1.0.1",
"app_version": "3.5.1",
"display_name": "Axol",
"beneficiary": "0xc74f57c8AB7Fd9f7dA37536dE3f75CB6763D32BE",
"validator_address": "0xc74f57c8AB7Fd9f7dA37536dE3f75CB6763D32BE",
"broker_url": "validator.testnet-3.elixirdev.xyz:9092",
"api url": "https://api.testnet-3.elixir.xyz"
}
root@Elixir:~# curl https://api.testnet-3.elixir.xyz/health/ | jq
{
"status": "up"
}
Please read our contribution guidelines for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
All notable changes to this project will be documented in this file. See CHANGELOG for details.