Update playbooks to generate genesis and run first in separate machines
This commit is contained in:
parent
a4cb808c96
commit
02772086c9
@ -3,8 +3,19 @@
|
||||
hosts: localhost
|
||||
vars_files:
|
||||
- first-validator-vars.yml
|
||||
vars:
|
||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
||||
spec_file: "{{data_directory}}/laconicd-spec.yml"
|
||||
connection: local
|
||||
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: Fetch repositories
|
||||
ansible.builtin.shell:
|
||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
|
||||
@ -43,3 +54,53 @@
|
||||
- name: Display staking-amount file location
|
||||
ansible.builtin.debug:
|
||||
msg: "Staking amount written to output/staking-amount.json"
|
||||
|
||||
- name: Create deployment spec file
|
||||
shell: |
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
||||
|
||||
- name: Create deployment from spec file
|
||||
shell: |
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
|
||||
|
||||
- name: Ensure tmp directory exists inside laconicd-data
|
||||
file:
|
||||
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy staking amount file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "output/staking-amount.json"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Copy genesis file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "output/genesis.json"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Prompt for validator private key
|
||||
vars:
|
||||
private_key_prompt: "Please enter your validator private key: "
|
||||
pause:
|
||||
prompt: "{{ private_key_prompt }}"
|
||||
echo: no
|
||||
register: private_key_input
|
||||
|
||||
- name: Fail if private key is not provided
|
||||
fail:
|
||||
msg: "Private key is required for creating the gentx."
|
||||
when: private_key_input.user_input | default('') | trim == ''
|
||||
|
||||
- name: Run script to create and collect gentx
|
||||
shell: |
|
||||
docker run -i \
|
||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
|
||||
-e "PVT_KEY={{ private_key_input.user_input }}" \
|
||||
-e "KEY_NAME={{ key_name }}" \
|
||||
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
||||
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
||||
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
|
||||
|
@ -20,8 +20,8 @@
|
||||
fail:
|
||||
msg: >-
|
||||
Required key files are not defined.
|
||||
Please set genesis_file and staking_amount_file in first-validator-vars.yml.
|
||||
when: not genesis_file or not staking_amount_file
|
||||
Please set genesis_file in first-validator-vars.yml.
|
||||
when: not genesis_file
|
||||
|
||||
- name: Fetch laconicd stack
|
||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
@ -63,42 +63,12 @@
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy staking amount file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ staking_amount_file }}"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Copy genesis file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ genesis_file }}"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Prompt for validator private key
|
||||
vars:
|
||||
private_key_prompt: "Please enter your validator private key: "
|
||||
pause:
|
||||
prompt: "{{ private_key_prompt }}"
|
||||
echo: no
|
||||
register: private_key_input
|
||||
|
||||
- name: Fail if private key is not provided
|
||||
fail:
|
||||
msg: "Private key is required for creating the gentx."
|
||||
when: private_key_input.user_input | default('') | trim == ''
|
||||
|
||||
- name: Run script to create and collect gentx
|
||||
shell: |
|
||||
docker run -i \
|
||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
|
||||
-e "PVT_KEY={{ private_key_input.user_input }}" \
|
||||
-e "KEY_NAME={{ key_name }}" \
|
||||
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
||||
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
||||
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
|
||||
|
||||
- name: Run validator node
|
||||
shell: |
|
||||
laconic-so deployment --dir {{data_directory}}/{{ mainnet_deployment_dir }} start
|
||||
|
Loading…
Reference in New Issue
Block a user