community / community.general / 2.5.9 / module / github_key Manage GitHub access keys. Authors: Robert Estelle (@erydo)community.general.github_key (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
Creates, removes, or updates GitHub access keys.
- name: Read SSH public key to authorize ansible.builtin.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 }}'
name: description: - SSH key name required: true type: str force: default: 'yes' description: - The default is C(yes), which will replace the existing remote key if it's different than C(pubkey). If C(no), the key will only be set if no key with the given C(name) exists. type: bool state: choices: - present - absent default: present description: - Whether to remove a key, ensure that it exists, or update its value. type: str token: description: - GitHub Access Token with permission to list and create public keys. required: true type: str pubkey: description: - SSH public key value. Required when C(state=present). type: str
deleted_keys: description: An array of key objects that were deleted. Only present on state=absent returned: When state=absent sample: - created_at: YYYY-MM-DDTHH:MM:SZ id: 0 key: BASE64 encoded key read_only: false url: http://example.com/github key type: list key: description: Metadata about the key just created. Only present on state=present returned: success sample: created_at: YYYY-MM-DDTHH:MM:SZ id: 0 key: BASE64 encoded key read_only: false url: http://example.com/github key type: dict matching_keys: description: An array of keys matching the specified name. Only present on state=present returned: When state=present sample: - created_at: YYYY-MM-DDTHH:MM:SZ id: 0 key: BASE64 encoded key read_only: false url: http://example.com/github key type: list