local/roles/git/tasks/Windows-installer.yaml
Kenneth Benzie (Benie) e711b9f3b2 Add optional GitHub API authentication headers
If the `GITHUB_TOKEN` is defined in the Ansible controller's
environment it is used to set the GitHub REST API authentication header.
This is they passed to all `uri` modules tasks which interact with the
GitHub REST API. If the `GITHUB_TOKEN` is not set, the authentication
header is not used.

Fixes #19
2024-04-06 16:35:01 +01:00

36 lines
1.0 KiB
YAML

---
- name: get json containing all releases
win_uri:
url: 'https://api.github.com/repos/git-for-windows/git/releases/tags/v{{git_version}}.windows.1'
headers: '{{github_auth_headers}}'
return_content: true
register: git_release
- set_fact:
git_installer_exe: 'Git-{{git_version}}-64-bit.exe'
- set_fact:
git_asset_query: '[?contains(name, `{{git_installer_exe}}`)] | [0]'
git_installer_path: '{{ansible_env.TEMP}}/{{git_installer_exe}}'
- name: select asset from release
set_fact:
git_asset: '{{git_release.json.assets | json_query(git_asset_query)}}'
- name: download installer
win_get_url:
url: '{{git_asset.browser_download_url}}'
dest: '{{git_installer_path}}'
- name: run installer command
win_command:
argv:
- '{{git_installer_path}}'
- '/GitAndUnixToolsOnPath'
- '/NoShellIntegration'
- '/NoGuiHereIntegration'
- '/NoCredentialManager'
- '/NoOpenSSH'
- '/Silent'
- '/SuppressMsgBoxes'
- '/NoCancel'
- '/NoRestart'