---
title: Github Key
slug: homologacao-atmosphere/github-key
description: Learn how to effectively manage GitHub access keys with this comprehensive module summary. Discover the necessary parameters, like key name and public key value, and explore practical examples in YAML format. Gain insights into the returned values, includ
createdAt: 2021-03-16T17:10:27.000Z
---

## Resumo

- Cria, remove ou atualiza as chaves de acesso do GitHub.

## Parâmetros

| **Parâmetro**            | **Tipo** | **Escolhas \| Valor Padrão             &#x20;**  | **Comentários**                                                                                                                                                      |
| ------------------------ | -------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| força                    | boolean  | Escolhas:<br />- false<br />- true (default)     | O padrão é true, que substituirá a chave remota existente se for diferente de pubkey. Se false, a chave só será definida se nenhuma chave com o dado `name` existir. |
| name - required          | string   |                                                  | Nome da chave SSH                                                                                                                                                    |
| pubkey                   | string   |                                                  | Valor da chave pública SSH. Obrigatório quando `state=present`.                                                                                                      |
| state                    | string   | Escolhas:<br />- present (default)<br />- absent | Se deseja remover uma chave, garantir que ela exista ou atualizar seu valor.                                                                                         |
| token - required         | string   |                                                  | Token de acesso do GitHub com permissão para listar e criar chaves públicas.                                                                                         |




## Exemplos

```yaml
# Read SSH public key to authorize
  ansible.builtin.shell: cat /home/foo/.ssh/id_rsa.pub
  register: ssh_pub_key

# Authorize key with GitHub
  local_action:
    module: github_key
    name: Access Key for Some Machine
    token: '{{ github_access_token }}'
    pubkey: '{{ ssh_pub_key.stdout }}'

```

## Valores Retornados

| **Chave**      | **Tipo**               | **Retornado quando** | **Descrição**                                                                                 |
| -------------- | ---------------------- | -------------------- | --------------------------------------------------------------------------------------------- |
| deleted\_keys  | list / elements=string | state=absent         | Uma matriz de objetos principais que foram excluídos. Apenas presente no `state=absent`       |
| key            | dictionary             | sucesso              | Metadados sobre a chave recém-criada. Apenas presente no `state=absent`                       |
| matching\_keys | list / elements=string | state=absent         | Uma matriz de chaves que correspondem ao nome especificado. Apenas presente no `state=absent` |



