local/roles/git/tasks/Windows.yaml
Kenneth Benzie (Benie) 337237a6e8 Pin Git to v2.36.1 on Windows so win_git works
Git for Windows v2.37.3 (and probably all version in the v2.37 series)
cause the unofficial win_git module to hang. Downgrading the v2.36.1
works around this issue for the time being. The Chocolatey package for
Git also does not respect the version flag, so installation is now
performed manually by grabbing the v2.36.1 installer from the GitHub
release asset and running it manually when installation is required.
2022-09-10 15:04:54 +01:00

46 lines
1.3 KiB
YAML

---
# Pinned to 2.36.1 because the unofficial win_git module hangs when using
# 2.37.3, this is either a breaking change in 2.37.x or an incompatibility with
# the win_git module. The git chocolatey package does not respect the version
# argument and always installs the most recent version, so instead download the
# installer from GitHub and install manually.
- set_fact:
git_version: 2.36.1
git_cli_exe: '{{ansible_env.ProgramFiles}}/Git/cmd/git.exe'
git_run_installer: false
- name: detect if Git for Windows is installed
win_stat:
path: '{{git_cli_exe}}'
register: git_cli_stat
- when: not git_cli_stat.stat.exists
set_fact:
git_run_installer: true
- name: check installed version
when: git_cli_stat.stat.exists
win_command: '"{{git_cli_exe}}" --version'
register: git_cli_version
changed_when: false
- when: git_cli_stat.stat.exists and git_version not in git_cli_version.stdout
set_fact:
git_run_installer: true
- include_tasks: Windows-installer.yaml
when: git_run_installer
- name: clone config repos
win_git:
repo: '{{item.repo}}'
dest: '{{ansible_env.USERPROFILE}}/.config/{{item.name}}'
version: master
with_items: '{{git_config_repos}}'
timeout: 30
# - TODO: install pip packages
# win_pip:
# name: '{{git_pip_packages}}'
# state: latest