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
This commit is contained in:
2024-04-06 16:33:03 +01:00
parent 883fee21b3
commit e711b9f3b2
17 changed files with 38 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
---
- hosts: windows
vars:
github_auth_headers: >-
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles:
- role: python
- role: git