---

- name: Install needed tools
  package:
    name:
      - tar
      - zstd
  tags: drbd

- when: drbdtop_install_mode != 'none'
  block:
    - name: Download drbdtop
      get_url:
        url: "{{ drbdtop_bin_url }}"
        dest: "{{ drbdtop_root_dir }}/bin/drbdtop"
        checksum: sha256:{{ drbdtop_bin_sha256 }}
        mode: 755
  tags: drbd

- name: Install wrapper script
  copy:
    content: |
      #!/bin/sh
      TERM=xterm {{ drbdtop_root_dir }}/bin/drbdtop "$@"
    dest: /usr/local/bin/drbdtop
    mode: 755
  tags: drbd
