community.general.github_app_access_token lookup – Obtain short-lived Github App Access tokens
Note
This lookup plugin is part of the community.general collection (version 9.5.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this lookup plugin,
see Requirements for details.
To use it in a playbook, specify: community.general.github_app_access_token
.
New in community.general 8.2.0
Synopsis
This generates a Github access token that can be used with a
git
command, if you use a Github App.
Requirements
The below requirements are needed on the local controller node that executes this lookup.
Keyword parameters
This describes keyword parameters of the lookup. These are the values key1=value1
, key2=value2
and so on in the following
examples: lookup('community.general.github_app_access_token', key1=value1, key2=value2, ...)
and query('community.general.github_app_access_token', key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
Your GitHub App ID, you can find this in the Settings page. |
|
The installation ID that contains the git repository you would like access to. As of 2023-12-24, this can be found via Settings page > Integrations > Application. The last part of the URL in the configure button is the installation ID. Alternatively, you can use PyGithub (https://github.com/PyGithub/PyGithub) to get your installation ID. |
|
Path to your private key. |
|
How long the token should last for in seconds. Default: |
Examples
- name: Get access token to be used for git checkout with app_id=123456, installation_id=64209
ansible.builtin.git:
repo: >-
https://x-access-token:{{ github_token }}@github.com/hidden_user/super-secret-repo.git
dest: /srv/checkout
vars:
github_token: >-
lookup('community.general.github_app_access_token', key_path='/home/to_your/key',
app_id='123456', installation_id='64209')
Return Value
Key |
Description |
---|---|
A one-element list containing your GitHub access token. Returned: success |