Ansible playbooks to setup Matic validator node.
Make sure you are using python3.x with Ansible. To check: ansible --version
Note: If your ssh public key (~/.ssh/id_rsa.pub) is already on the remote machines, skip this step.
Copy pem private key file as .workspace/private.pem to enable ssh through ansible. If you don't have pem file, just make sure you can reach remote machines from your own machine using ssh (ssh <username>@ip).
Ansible manages hosts using inventory.yml file.
Setup inventory
Add nodes ip's in inventory.yml as example
Example:
#add your instance ips here in palce of xx..
xxx.xxx.xx.xx # <----- Add IP for sentry/validator node
Note: By default the user to login is setup as ubuntu in group_vars/all file. If you have a specific user to be logged in with please change the username in this file.
To check if nodes are reachable, run following commands:
# to check if nodes are reachable
ansible all -m pingThere are two networks available:
mainnet(Mainnet v1)mumbai(Mumbai testnet)
While running Ansible playbook, network node_type heimdall_version bor_version needs to be set. These Values can be passed in --extra-var
To show list of hosts where the playbook will run (notice --list-hosts at the end):
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=sentry" --list-hostsTo run actual playbook on sentry nodes:
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=sentry"To show list of hosts where the playbook will run (notice --list-hosts at the end):
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=validator" --list-hostsTo run actual playbook on validator node:
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=validator"To show list of hosts where the playbook will run (notice --list-hosts at the end):
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=archive" --list-hostsTo run actual playbook on archive node:
ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=archive"To check the sync status you can run the follwing command on your node
$ curl http://localhost:26657/statusThe key called catching_up will show your sync status, if it's not catching up it means that you are fully synced!
Start The Bor service after the above command shows as false that mean heimdall is in sync
Command to Start Bor Service
sudo service bor startTo clean deployed setup (warning: this will delete all blockchain data)
ansible-playbook -l <group-name> playbooks/clean.ymlTo show Heimdall account
ansible-playbook -l <group-name> playbooks/show-heimdall-account.ymlTo increase ulimit
ansible-playbook -l <group-name> playbooks/ulimit.ymlTo setup prometheus exporters
ansible-playbook -l <group-name> playbooks/setup-exporters.ymlThis will install node and process exporter on machines for prometheus monitoring. Both exporters will be available at default ports.
To reboot machine
ansible-playbook -l <group-name> playbooks/reboot.ymlTo setup Heimdall
ansible-playbook playbooks/heimdall.yml --extra-var="heimdall_version=v0.3.0 network=mainnet node_type=sentry"To show list of hosts where the playbook will run:
ansible-playbook playbooks/heimdall.yml --extra-var="heimdall_version=v0.3.0 network=mainnet node_type=sentry" --list-hostsTo setup Bor
ansible-playbook playbooks/heimdall.yml --extra-var="bor_version=v0.3.0 network=mainnet node_type=sentry"To show list of hosts where the playbook will run:
ansible-playbook playbooks/heimdall.yml --extra-var="bor_version=v0.3.0 network=mainnet node_type=sentry" --list-hostsPing
Just to see if machines are reachable:
ansible all -m pingping is a module name. You can any module and arguments here.
Run shell command
Following command will fetch and print all disk space stats from all hosts.
ansible all -m shell -a "df -h"