laconicd-stack/playbooks/validator/create-validator.yml
shreerang 3d7ba45796 Add playbook to send create-validator tx for subsequent nodes (#3)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e of cerc-io/laconicd#66
- Use calculated staking amount for running validator nodes

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Reviewed-on: #3
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
2025-05-16 09:54:09 +00:00

31 lines
1.2 KiB
YAML

---
- name: Create validator on running chain
hosts: localhost
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
key_name: "{{ lookup('env', 'KEY_NAME') }}"
pvt_key: "{{ lookup('env', 'PVT_KEY') }}"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fail if pvt_key is not set
fail:
msg: >-
Neither private key (pvt_key) is set.
Please export PVT_KEY.
when: not pvt_key
- name: Import private key in laconicd
shell: |
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "laconicd keys import-hex {{ key_name }} {{ pvt_key }} --keyring-backend test"
- name: Run create-validator script
shell: |
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "KEY_NAME={{ key_name }} /scripts/create-validator.sh"