---
- name: fetch node manager inventory from remote machines
  hosts: all
  ignore_unreachable: yes
  max_fail_percentage: 10
  tasks:
    - name: check if node registry file exists
      stat:
        path: "/var/safenode-manager/node_registry.json"
      register: file_stat

    - name: fetch inventory file
      fetch:
        src: "/var/safenode-manager/node_registry.json"
        dest: "{{dest}}"
        flat: no
        validate_checksum: no
      when: file_stat.stat.exists
