community.general.github_secrets module – Manage GitHub repository or organization secrets
Note
This module is part of the community.general collection (version 12.5.0).
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 module,
see Requirements for details.
To use it in a playbook, specify: community.general.github_secrets.
New in community.general 12.5.0
Synopsis
Create, update, or delete secrets in a GitHub repository or organization.
Requirements
The below requirements are needed on the host that executes this module.
pynacl
Parameters
Parameter |
Comments |
|---|---|
The base URL for the GitHub API. Default: |
|
The name of the secret. |
|
The GitHub username or organization name. |
|
The name of the repository. If not provided, the secret will be managed at the organization level. |
|
The desired state of the secret. Choices:
|
|
The GitHub token used for authentication. |
|
The value of the secret. Required when |
|
The visibility of the secret when set at the organization level. Required when Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
Examples
- name: Add Github secret
community.general.github_secrets:
token: "{{ lookup('ansible.builtin.env', 'GITHUB_TOKEN') }}"
repository: "ansible"
organization: "ansible"
key: "TEST_SECRET"
value: "bob"
state: "present"
- name: Delete Github secret
community.general.github_secrets:
token: "{{ lookup('ansible.builtin.env', 'GITHUB_TOKEN') }}"
repository: "ansible"
organization: "ansible"
key: "TEST_SECRET"
state: "absent"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The result of the module. Returned: always Sample: |