chain-spec-node-keys.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 | regex_replace("\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]", "") }}'
  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. run_once: true
  48. when: run_on_admin_server|bool
  49. - name: Copy joystream-node binary to localhost
  50. fetch:
  51. src: "{{ admin_code_dir }}/target/release/joystream-node"
  52. dest: "{{ data_path }}/joystream-node"
  53. flat: yes
  54. delegate_to: "{{ local_or_admin }}"
  55. run_once: true
  56. when: run_on_admin_server|bool
  57. - name: Copying chain spec file to all servers
  58. copy:
  59. src: "{{ chain_spec_path }}"
  60. dest: "{{ remote_chain_spec_path }}"