Note
This plugin is part of the community.general collection (version 3.8.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
.
To use it in a playbook, specify: community.general.github_repo
.
New in version 2.2.0: of community.general
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
access_token string | Token parameter for authentication. This is only needed when not using username and password. | |
api_url string added in 3.5.0 of community.general | Default: "https://api.github.com" | URL to the GitHub API if not using github.com but you own instance. |
description string | Default: "" | Description for the repository. This is only used when state is present . |
name string / required | Repository name. | |
organization string | Organization for the repository. When state is present , the repository will be created in the current user profile. | |
password string | Password used for authentication. This is only needed when not using access_token. | |
private boolean |
| Whether the new repository should be private or not. This is only used when state is present . |
state string |
| Whether the repository should exist or not. |
username string | Username used for authentication. This is only needed when not using access_token. |
Note
check_mode
.- name: Create a Github repository community.general.github_repo: access_token: mytoken organization: MyOrganization name: myrepo description: "Just for fun" private: yes state: present register: result - name: Delete the repository community.general.github_repo: username: octocat password: password organization: MyOrganization name: myrepo state: absent register: result
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
repo dictionary | success and state is present
| Repository information as JSON. See https://docs.github.com/en/rest/reference/repos#get-a-repository. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/github_repo_module.html