---
-
  name: "Managing progress for {{ ansible_role_name }}"
  when: count_progress | default(false)
  run_once: true
  block:
    -
      name: "Incrementing global progress step counter for {{ ansible_role_name }}"
      ansible.builtin.set_fact:
        global_current_progress_step: "{{ global_current_progress_step | default(0) | int + 1 }}"

    -
      name: "Including progress reporting task for {{ ansible_role_name }}"
      ansible.builtin.include_role:
        name: startcloud.startcloud_roles.progress
      vars:
        _progress_role_is_setup_run: false
        current_progress_step: "{{ global_current_progress_step | default(0) }}"
        progress_description: "{{ progress_role_description | default('Processing ' + ansible_role_name) }}"

-
  name: "Block to Allow Loading of Variables without running task"
  when: run_tasks
  block:
    -
      name: "Setting up BGInfo"
      block:
        -
          name: "Creating BGInfo directory"
          ansible.windows.win_file:
            path: "{{ bginfo_directory }}"
            state: directory

        -
          name: "Creating Default Users Startup directory"
          ansible.windows.win_file:
            path: "{{ startup_directory }}"
            state: directory

        -
          name: "Downloading Prominic.bgi"
          ansible.windows.win_get_url:
            url: "{{ bginfo_config_url }}"
            dest: "{{ bginfo_directory }}\\STARTcloud.bgi"

        -
          name: "Creating Startup Directory"
          ansible.windows.win_file:
            path: "{{ startup_directory }}"
            state: directory

        -
          name: "Creating BGInfo shortcut in startup folder"
          community.windows.win_shortcut:
            src: "C:\\ProgramData\\chocolatey\\lib\\bginfo\\Tools\\Bginfo64.exe"
            dest: "{{ startup_directory }}\\Bginfo64.lnk"
            arguments: "{{ bginfo_directory }}\\STARTcloud.bgi /timer:0 /nolicprompt /silent"
            description: "BGInfo System Information Display"
