---
- name: Check HAGrid Directory
  stat:
    path: "{{ build_dir }}/packages/hagrid"
    get_checksum: no
    get_md5: no
    mime: no
  register: hagrid_dir_exists

- name: Delete build directory
  shell: "rm -rf {{ build_dir }}"
  become: yes
  when: hagrid_dir_exists.stat.exists == False and vagrant is not defined and install == "true"

- name: Copy code checkout to build
  ansible.builtin.copy:
    src: "{{ syft_dir }}"
    dest: "{{ build_dir }}"
    force: yes
    remote_src: yes
    owner: "{{ om_user }}"
    group: "{{ om_user }}"
  become_user: "{{ om_user }}"
  ignore_errors: yes
  when: hagrid_dir_exists.stat.exists == False and vagrant is not defined and install == "true"

- name: Install HAGrid
  shell: "runuser -l {{ om_user }} -c 'pip install -e {{ build_dir }}/packages/hagrid'"
  become: yes
  when: vagrant is not defined and install == "true"

- name: Install HAGrid
  shell: "runuser -l {{ om_user }} -c 'pip install -e {{ syft_dir }}/packages/hagrid'"
  become: yes
  when: vagrant is defined and install == "true"

---
- name: Check HAGrid Directory
  stat:
    path: "{{ build_dir }}/packages/hagrid"
    get_checksum: no
    get_md5: no
    mime: no
  register: hagrid_dir_exists

- name: Delete build directory
  shell: "rm -rf {{ build_dir }}"
  become: yes
  when: hagrid_dir_exists.stat.exists == False and vagrant is not defined and install == "true"

- name: Copy code checkout to build
  ansible.builtin.copy:
    src: "{{ syft_dir }}/"
    dest: "{{ build_dir }}"
    force: yes
    remote_src: yes
    owner: "{{ om_user }}"
    group: "{{ om_user }}"
  become_user: "{{ om_user }}"
  ignore_errors: yes
  when: hagrid_dir_exists.stat.exists == False and vagrant is not defined and install == "true"

- name: Install HAGrid
  shell: "runuser -l {{ om_user }} -c 'pip install -e {{ build_dir }}/packages/hagrid'"
  become: yes
  when: vagrant is not defined and install == "true"

- name: Install HAGrid
  shell: "runuser -l {{ om_user }} -c 'pip install -e {{ syft_dir }}/packages/hagrid'"
  become: yes
  when: vagrant is defined and install == "true"

Make sure PySyft -> build copy goes to the correct level
Make sure PySyft -> build copy goes to the correct level
