community.general.scaleway_security_group_rule 模块 – Scaleway 安全组规则管理模块

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.general

要在 playbook 中使用它,请指定:community.general.scaleway_security_group_rule

概要

参数

参数

注释

action

字符串 / 必需

规则操作。

选择

  • "accept"

  • "drop"

api_timeout

别名: timeout

整数

到 Scaleway API 的 HTTP 超时(以秒为单位)。

默认值: 30

api_token

别名: oauth_token

字符串 / 必需

Scaleway OAuth 令牌。

api_url

别名: base_url

字符串

Scaleway API URL。

默认值: "https://api.scaleway.com"

direction

字符串 / 必需

规则方向。

选择

  • "inbound"

  • "outbound"

ip_range

字符串

要应用于规则的 IPV4 CIDR 表示法。

默认值: "0.0.0.0/0"

port

整数 / 必需

与规则相关的端口,所有端口的空值。

protocol

字符串 / 必需

要使用的网络协议。

选择

  • "TCP"

  • "UDP"

  • "ICMP"

query_parameters

字典

传递到查询字符串的参数列表。

默认值: {}

region

字符串 / 必需

要使用的 Scaleway 区域(例如 par1)。

选择

  • "ams1"

  • "EMEA-NL-EVS"

  • "par1"

  • "EMEA-FR-PAR1"

  • "par2"

  • "EMEA-FR-PAR2"

  • "waw1"

  • "EMEA-PL-WAW1"

security_group

字符串 / 必需

安全组唯一标识符。

state

字符串

指示安全组规则的所需状态。

选择

  • "present" ← (默认)

  • "absent"

validate_certs

布尔值

验证 Scaleway API 的 SSL 证书。

选择

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持: 完全

可以在 check_mode 中运行并返回已更改的状态预测,而无需修改目标。

diff_mode

支持:

当处于 diff 模式时,将返回已更改(或可能需要在 check_mode 中更改)的内容的详细信息。

注意

注意

示例

- name: Create a Security Group Rule
  community.general.scaleway_security_group_rule:
    state: present
    region: par1
    protocol: TCP
    port: 80
    ip_range: 0.0.0.0/0
    direction: inbound
    action: accept
    security_group: b57210ee-1281-4820-a6db-329f78596ecb
  register: security_group_rule_creation_task

返回值

通用返回值已在此处记录,以下是此模块特有的字段

描述

data

字典

仅当 state=present 时出现。

返回:state=present

示例: {"scaleway_security_group_rule": {"action": "accept", "dest_port_from": 80, "dest_port_to": null, "direction": "inbound", "editable": null, "id": "10cb0b9a-80f6-4830-abd7-a31cd828b5e9", "ip_range": "0.0.0.0/0", "position": 2, "protocol": "TCP"}}

作者

  • Antoine Barbare (@abarbare)