chain-spec-node-keys.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. # Create chain spec files and keys and copy to all the servers
  3. - name: Debug to test variable
  4. debug:
  5. msg: "Data path: {{ data_path }}, Chain Spec path: {{ chain_spec_path }}"
  6. run_once: true
  7. - name: Run chain-spec-builder to generate chainspec.json file
  8. command: "{{ admin_code_dir }}/target/release/chain-spec-builder generate -a 2 --chain-spec-path {{ chain_spec_path }} --deployment live --endowed 1 --keystore-path {{ data_path }}"
  9. register: chain_spec_output
  10. delegate_to: "{{ local_or_admin }}"
  11. run_once: true
  12. - name: Run subkey to generate node keys
  13. shell: subkey generate-node-key
  14. delegate_to: "{{ local_or_admin }}"
  15. register: subkey_output
  16. - name: Print to stdout
  17. debug:
  18. msg:
  19. - "Public Key: {{ subkey_output.stderr }}"
  20. - "Private Key: {{ subkey_output.stdout }}"
  21. - name: Print to stdout chain spec
  22. debug: var=chain_spec_output.stdout
  23. run_once: true
  24. - name: Save output of chain spec to local file
  25. copy:
  26. content: "{{ chain_spec_output.stdout }}"
  27. dest: "{{ data_path }}/chain_spec_output.txt"
  28. delegate_to: "{{ local_or_admin }}"
  29. run_once: true
  30. - name: Change chain spec name, id, protocolId
  31. json_modify:
  32. chain_spec_path: "{{ chain_spec_path }}"
  33. prefix: "{{ network_suffix }}"
  34. all_nodes: "{{ hostvars }}"
  35. delegate_to: "{{ local_or_admin }}"
  36. register: result
  37. run_once: true
  38. - name: Print output of modified chainspec
  39. debug:
  40. var: result.result
  41. run_once: true
  42. - name: Copying chain spec files to localhost
  43. synchronize:
  44. src: "/home/ubuntu/{{ data_path }}/"
  45. dest: "{{ data_path }}"
  46. mode: pull
  47. delegate_to: "{{ local_or_admin }}"
  48. run_once: true
  49. when: run_on_admin_server|bool
  50. - name: Copy joystream-node binary to localhost
  51. fetch:
  52. src: "{{ admin_code_dir }}/target/release/joystream-node"
  53. dest: "{{ data_path }}/joystream-node"
  54. flat: yes
  55. delegate_to: "{{ local_or_admin }}"
  56. run_once: true
  57. when: run_on_admin_server|bool
  58. - name: Copying chain spec file to all servers
  59. copy:
  60. src: "{{ chain_spec_path }}"
  61. dest: "{{ remote_chain_spec_path }}"