I have a YAML file filled with variables that I need to download with an Ansible role and this file lives within GitHub.
In a temporary hacky way I first run a curl command to get the download URL using this URL: https://<PAT>@api.github.com/repos/<org>/<repoName>/contents/<filePath>/<fileName>.yml
The download URL I get from the above command is:
https://raw.githubusercontent.com/<org>/<repoName>/develop/<filePath>/<fileName>.yml?token=<token>
My Ansible role looks like:
- name: Download vars file from VCS
get_url:
url: '<downloadUrl>'
dest: '{{ playbook_dir }}/<fileName>.yml'
delegate_to: localhost
This task fails saying:
15:24:43 TASK [get_vars : Download vars file from VCS] **********************************
15:24:43 Request failed
15:24:43
15:24:43
15:24:43 NO MORE HOSTS LEFT *************************************************************
I am running this fine using an Azure DevOps with the URL: https://dev.azure.com/<org>/<repoName>/_apis/git/repositories/<repoName>/items?versionType=branch&version=develop&path=<filePath>/<fileName>.yml
How do I download a file from my GitHub repository to then be able to use the variables within?