new-node-playbook.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. # Configure chain spec file, copy joystream-node binary and run the service
  3. - name: Create and copy the chain-spec file
  4. hosts: all
  5. gather_facts: no
  6. tasks:
  7. - name: Download chain spec file using link
  8. get_url:
  9. url: "{{ chain_spec_file }}"
  10. dest: ~/chain-spec.json
  11. when: chain_spec_file is search("http")
  12. - name: Copy chain spec file from local
  13. copy:
  14. src: "{{ chain_spec_file }}"
  15. dest: ~/chain-spec.json
  16. when: chain_spec_file is not search("http")
  17. - name: Download and unarchive binary using link
  18. unarchive:
  19. src: "{{ binary_file }}"
  20. dest: ~/
  21. remote_src: yes
  22. when: binary_file is search("http")
  23. - name: Copy binary from local
  24. copy:
  25. src: "{{ binary_file }}"
  26. dest: ~/joystream-node
  27. mode: "0775"
  28. when: binary_file is not search("http")
  29. - name: Create a service file
  30. template:
  31. src: roles/node/templates/joystream-node.service.j2
  32. dest: /etc/systemd/system/joystream-node.service
  33. vars:
  34. template_remote_chain_spec_path: "/home/ubuntu/chain-spec.json"
  35. template_binary_path: "/home/ubuntu/joystream-node"
  36. become: yes
  37. - name: Start service joystream-node, if not started
  38. service:
  39. name: joystream-node
  40. state: started
  41. become: yes