---
# Run setup and build code

- name: Creat bash profile file
  command: "touch /home/ubuntu/.bash_profile"

- name: Run setup script
  command: ./setup.sh
  args:
    chdir: "{{ remote_code_path }}"

- name: Build joystream node
  shell: . ~/.bash_profile && yarn cargo-build
  args:
    chdir: "{{ remote_code_path }}"
  async: 3600
  poll: 0
  register: build_result

- name: Check on build async task
  async_status:
    jid: "{{ build_result.ansible_job_id }}"
  register: job_result
  until: job_result.finished
  retries: 36
  delay: 100
