---
title: Open/Close port
slug: homologacao-atmosphere/openclose-port
description: Learn how to open or close a door using this module. Discover the parameters involved, such as the action (add or remove), port number, and protocol. This module integrates with the Shell module and offers a comprehensive example for implementation. Find 
createdAt: 2022-07-26T13:52:02.000Z
---

## Resumo

- Abrir/Fechar porta

## Parâmetros

| **Parâmetro**                                                                                                                                                                                                                                                                                   | **Tipo** | **Escolhas \| Valor Padrão** | **Comentários**      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------- | -------------------- |
| add\_remove<br />string<br />- Any ***(default)***<br />- Domain<br />- NotApplicable<br />- Public<br />- Private<br />Service Group a ser filtrado.<br />string<br />- Any ***(default)***<br />- Domain<br />- NotApplicable<br />- Public<br />- Private<br />Service Group a ser filtrado. | string   | - add<br />- remove          | ação a ser realizada |
| port                                                                                                                                                                                                                                                                                            | integer  |                              | porta                |
| protocol                                                                                                                                                                                                                                                                                        | string   | - tcp<br />- udp<br />- icmp | protocolo            |

Utiliza parâmetros do módulo [Shell](https://docs.simonops.com/homologacao-atmosphere/shell).

## Exemplos

```yaml
- shell: 
    arguments: sudo firewall-cmd --permanent --{{ input.add_remove }}-port={{ input.port }}/{{ input.protocol }}
  register: result
```

## Valores retornados

| **Chave**        | **Tipo** | **Retornado quando** | **Descrição**              |
| ---------------- | -------- | -------------------- | -------------------------- |
| output           | string   | Sempre               | Saída da execução          |
| had\_errors      | boolean  | Sempre               | Se teve erros              |
| output\_errors   | string   | Sempre               | Erros de saída da execução |
| output\_warnings | string   | Sempre               | Avisos de saída            |

