- tags: [asdf]
  block:
    - name: Create directory for asdf
      file:
        path: "{{ asdf_install_dir }}"
        state: directory
        recurse: yes
        owner: "{{ user.name }}"
        group: "{{ user.group }}"
        mode: 0o700

    - name: Install asdf version manager
      git:
        repo: https://github.com/asdf-vm/asdf.git
        version: "{{ asdf_version }}"
        dest: "{{ asdf_install_dir }}"
        update: no
        clone: yes

    - name: Configure asdf
      template:
        src: configure_asdf.sh
        dest: "{{ shell_conf_dir }}/bash"
        mode: 0o700
        owner: "{{ user.name }}"
        group: "{{ user.group }}"

    - name: Configure global .gitignore for asdf
      blockinfile:
        path: "{{ git_global_ignore_file }}"
        block: .tool-versions
        marker: "# {mark} configuration for asdf virtual manager"

- tags: [asdf]
  block:
    - name: Create directory for asdf
      file:
        path: "{{ asdf_install_dir }}"
        state: directory
        recurse: yes
        owner: "{{ user.name }}"
        group: "{{ user.group }}"
        mode: 0o700

    - name: Install asdf version manager
      git:
        repo: https://github.com/asdf-vm/asdf.git
        version: "{{ asdf_version }}"
        dest: "{{ asdf_install_dir }}"
        force: yes
        update: yes
        clone: yes

    - name: Configure asdf
      template:
        src: configure_asdf.sh
        dest: "{{ shell_conf_dir }}/bash"
        mode: 0o700
        owner: "{{ user.name }}"
        group: "{{ user.group }}"

    - name: Configure global .gitignore for asdf
      blockinfile:
        path: "{{ git_global_ignore_file }}"
        block: .tool-versions
        marker: "# {mark} configuration for asdf virtual manager"

Set force=yes while cloning repository
asdf: Set force=yes while cloning repository
