ansible block creates

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_blocks.html

---
- name: register status of /tmp/toolbox.tar.gz
  stat:
    path: /tmp/toolbox.tar.gz
  register: toolbox_path

- name: install jetbrains toolbox
  # check if toolbox_path is a regular file
  when: "not toolbox_path.stat.exists"
  block:
    - name: download toolbox
      get_url:
        url: "https://download.jetbrains.com/toolbox/jetbrains-toolbox-{{ toolbox_version }}.tar.gz"
        dest: /tmp/toolbox.tar.gz

    - name: open toolbox
      unarchive:
        src: /tmp/toolbox.tar.gz
        dest: /opt/jetbrains-toolbox

https://serverfault.com/questions/1065752/in-ansible-playbook-how-skip-task-if-file-already-exist-in-block-task