github_key - Manage GitHub access keys.
New in version 2.2.
Synopsis
- Creates, removes, or updates GitHub access keys.
Parameters
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| force bool |
| The default is yes, which will replace the existing remote key if it's different than pubkey. If no, the key will only be set if no key with the given name exists. |
| name required | SSH key name | |
| pubkey | SSH public key value. Required when state=present. | |
| state |
| Whether to remove a key, ensure that it exists, or update its value. |
| token required | GitHub Access Token with permission to list and create public keys. |
Examples
- name: Read SSH public key to authorize
shell: cat /home/foo/.ssh/id_rsa.pub
register: ssh_pub_key
- name: Authorize key with GitHub
local_action:
module: github_key
name: Access Key for Some Machine
token: '{{ github_access_token }}'
pubkey: '{{ ssh_pub_key.stdout }}'
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| deleted_keys list | When state=absent | An array of key objects that were deleted. Only present on state=absent Sample: [{'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False}] |
| key dict | success | Metadata about the key just created. Only present on state=present Sample: {'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False} |
| matching_keys list | When state=present | An array of keys matching the specified name. Only present on state=present Sample: [{'id': 0, 'key': 'BASE64 encoded key', 'url': 'http://example.com/github key', 'created_at': 'YYYY-MM-DDTHH:MM:SZ', 'read_only': False}] |
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Robert Estelle (@erydo)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/github_key_module.html